New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent GC behavior calling a host function returning an externref #8433
Comments
This commit fixes a panic when a host function defined with `Func::new` returned GC references and was called in async mode. The logic to auto-gc before the return values go to wasm asserted that a synchronous GC was possible but the context this function is called in could be either async or sync. The fix applied in this commit is to remove the auto-gc. This means that hosts will need to explicitly GC in these situations until auto-gc is re-added back to Wasmtime. cc bytecodealliance#8433 as this will make the behavior consistent, but we'll want to re-add the gc behavior.
In #8434 I'm making the behavior "consistent" but in the wrong direction. That PR is removing the auto-gc block I outlined above, which was the source of the panic. This is the "wrong direction", however, as we should still retain the gc-before-returning so hosts aren't required necessarily to GC themselves. (or we should perhaps decide that this is indeed the desired semantics). In that sense I'm going to leave this issue open after that PR lands. |
…lliance#8434) This commit fixes a panic when a host function defined with `Func::new` returned GC references and was called in async mode. The logic to auto-gc before the return values go to wasm asserted that a synchronous GC was possible but the context this function is called in could be either async or sync. The fix applied in this commit is to remove the auto-gc. This means that hosts will need to explicitly GC in these situations until auto-gc is re-added back to Wasmtime. cc bytecodealliance#8433 as this will make the behavior consistent, but we'll want to re-add the gc behavior.
This commit fixes a panic when a host function defined with `Func::new` returned GC references and was called in async mode. The logic to auto-gc before the return values go to wasm asserted that a synchronous GC was possible but the context this function is called in could be either async or sync. The fix applied in this commit is to remove the auto-gc. This means that hosts will need to explicitly GC in these situations until auto-gc is re-added back to Wasmtime. cc #8433 as this will make the behavior consistent, but we'll want to re-add the gc behavior.
…8439) This commit fixes a panic when a host function defined with `Func::new` returned GC references and was called in async mode. The logic to auto-gc before the return values go to wasm asserted that a synchronous GC was possible but the context this function is called in could be either async or sync. The fix applied in this commit is to remove the auto-gc. This means that hosts will need to explicitly GC in these situations until auto-gc is re-added back to Wasmtime. cc #8433 as this will make the behavior consistent, but we'll want to re-add the gc behavior.
For this program:
it will, as-is, run with:
However if the
"a"
is switched to"b"
to use thefunc_new
definition instead offunc_wrap
, it will run infinitely and have steady memory usage.The reason is that this block is only present in the
func_new
path, not thefunc_wrap
path.cc @fitzgen
The text was updated successfully, but these errors were encountered: