-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Wasmtime loops forever when wasm32-wasi-threads
guests write to stdout
#7745
Comments
What are the other runtimes this passes in? If I run this in runner.js
If the only other runtime is WAMR (from the issue thread you linked then WAMR has been known in the past for non-spec-compliant behavior. If there are other runtimes though then the mystery will deepen. |
Okay, I dug a bit deeper into this. Turns out all the Meanwhile, I've also updated the
The stack trace is a bit different each time I take a sample, but it's generally spinning in |
Maybe a |
Then it hangs with no further output. For reference: // argc_argv_main.c
#include <stdio.h>
int main(int argc, char *argv[]) {
puts("hello from argc argv main!");
return 0;
}
|
wasm32-wasi-threads
guestswasm32-wasi-threads
guests write to stdout
Previously, `first_non_empty_{c}io_vec` always returned `Ok(None)` for buffers residing in shared memories since they cannot, in general, safely be represented as slices. That caused e.g. `wasi-libc` to spin forever when trying to write to stdout using `fd_write` since it always got `Ok(0)` and never made progress. This commit changes the return type of both functions to use `GuestPtr` instead of `GuestSlice{Mut}`, allowing safe access to shared guest memory. Big thanks to Alex Crichton for narrowing this down and suggesting the fix. Fixes bytecodealliance#7745 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
Previously, `first_non_empty_{c}io_vec` always returned `Ok(None)` for buffers residing in shared memories since they cannot, in general, safely be represented as slices. That caused e.g. `wasi-libc` to spin forever when trying to write to stdout using `fd_write` since it always got `Ok(0)` and never made progress. This commit changes the return type of both functions to use `GuestPtr` instead of `GuestSlice{Mut}`, allowing safe access to shared guest memory. Big thanks to Alex Crichton for narrowing this down and suggesting the fix. Fixes #7745 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
UPDATE: The original issue was due to not specifying
-pthread
when building. Now the problem is that Wasmtime loops indefinitely when awasm32-wasi-threads
guest writes to stdout. See #7745 (comment) for steps to reproduce.Original report follows:
Per WebAssembly/wasi-libc#456 (comment), a number of
wasi-sdk
andwasi-libc
tests are currently failing when run using Wasmtime but run successfully on other runtimes. They seem to be related to thread-local storage (e.g. tests involvingerrno
, which is a thread-local variable).Test Case
This file was built from https://github.com/WebAssembly/wasi-sdk/blob/main/tests/general/signals.c for
wasm32-wasi-threads
usingwasi-sdk
:signals.c.-O0.wasm.tar.gz
Steps to Reproduce
First, install any recent version of Wasmtime (e.g. v16.0.0). Then:
Expected Results
The expected output is:
Actual Results
The actual output is:
Versions and Environment
Wasmtime version or commit: v16.0.0
Operating system: MacOS (but should repro on any OS)
Architecture: ARM64 (but should repro on any architecture)
Extra Info
See also WebAssembly/wasi-threads#49, which may be related.
The text was updated successfully, but these errors were encountered: