-
-
Notifications
You must be signed in to change notification settings - Fork 666
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
Crash when wasmtime invokes specific function #2099
Comments
Just an initial guess: Is it possible that |
From the Wasmtime side I think that's correct. If that's the case, is this a fix on the Wasmtime side or the AssemblyScript side? As I mentioned it used to work okay... |
I see that in the command line arguments |
Looking at the linked issue, with recent versions of the compiler it should be unnecessary to specify import "wasi";
export function foo(): void {
console.log("foo");
}
The Wasmtime command could be (with or without invoking _start, but haven't checked):
|
Thanks for the tips. Unfortunately it doesn't seem to help:
|
It does change something though: I don't get the cycling in the concat/visitRoots/abort loop any more:
|
Whoa! So when I removed Unfortunately, when I added a line that did a string operation ( |
|
It's the
|
If this is the untouched build, the only |
Yeah that was the untouched build ( |
Are you sure you could use multiply invoke commands? For WASI you definitely should insert |
You are right, seems one cannot For reference, I tried the same with the Wasmer CLI, which also doesn't work. As soon as |
Opened an issue at Wasmer. If there is interest in Wasmtime support as well, feel free to file an issue there as well. |
Response from the Wasmtime folks (bytecodealliance/wasmtime#3474 (comment)):
|
I guess we can alias |
This does seem like a tricky one - it sounds like WASI is making a distinction between two types of program which it's not obvious how to distinguish in AssemblyScript. We have also assumed that top-level statements do not run when we invoke On top of that, other languages seem not to care if something is a command or reactor: if we have a WASM module built from Rust we can invoke |
Invoking an export may require top-level code to have executed already, though, say var a = 1; // but more complex
export function foo(): i32 {
return a;
} where top-level code leading to An alternative could be to deprecate |
Update/clarification from a colleague who knows more about the WASI ABI than I do. It seems like the response from Wasmtime (quoted above) was slightly wrong.
(forgive me if this is all familiar ground to you folks, but I had copied a comment that implied something different, and wanted to clarify for anyone coming on this issue later) |
Took at stab at this in #2157, replacing the |
I am encountering a crash in Wasm generated with recent versions of AssemblyScript when I invoke a function other than the default entry point.
Repro setup
I am testing with AssemblyScript 0.19.17 and Wasmtime 0.30.0.
My
index.ts
is as follows:My
package.json
contains the following scripts:Symptoms
What I ran:
npm run build
wasmtime run --invoke foo ./build/untouched.wasm
Expected output:
foo
Actual output: many (stack overflow amount?) lines of error dump which repeats the following lines:
Additional information
wasmtime run ./build/untouched.wasm
works fine without crashing. (If I add some top level statements andwasmtime run
then these are executed correctly.) It's only when I pass the--invoke
option that things go wrong.The same problem occurs if I embed
wasmtime
and call its API to invoke a function other than_start
.The same problem occurs if I use
./build/optimized.wasm
, or the.wat
build output.The problem does not occur with AssemblyScript 0.17.2/as-wasi 0.4.3. With these versions
wasmtime run --invoke foo
runs correctly.Please let me know if you need any more info - thanks!
The text was updated successfully, but these errors were encountered: