bytecodealliance / wasmtime

A fast and secure runtime for WebAssembly
https://wasmtime.dev/
Apache License 2.0
14.82k stars 1.24k forks source link

`AsyncStdoutStream` causes hangs after first write #8781

Closed Licenser closed 3 weeks ago

Licenser commented 3 weeks ago

Test Case

A full reproduction, including the test case, can be found here: https://github.com/Licenser/wasi-io-hang

Steps to Reproduce

I would expect to be able to write multiple times from withtin the wasi program when using an AsyncStdoutStream as stdout.

Actual Results

The first write to stdout never finishes, and the wasi program hangs.

Versions and Environment

Wasmtime version or commit: 21.0.1

Operating system: OSX

Architecture: ARMv8 (M3)

Extra Info

I have looked for other examples of using AsyncStdoutStream, the main repository doesn't seem to have any more is it used in tests, I might be doing something wrong but this could be a genuine bug.

alexcrichton commented 3 weeks ago

Thanks for the report and reproduction! I think this should be fixed by https://github.com/bytecodealliance/wasmtime/pull/8782. Is that something you'd like to see backported to the Wasmtime 22 release happening on June 20? Otherwise it'll get released on July 20.

Licenser commented 3 weeks ago

Heya, thanks for the quick fix!

No need to backport it :) I appreciate the offer, but it's totally okay for me to point to a GitHub ref until the end of July - it's exploratory nonproduction code at the moment anyway, so I don't want to cause extra work for you.

Licenser commented 3 weeks ago

I just wanted to confirm the fix 👍. I tried it this morning, and it works like a charm. Thanks a lot Alex!