Stream: git-wasmtime

Topic: wasmtime / issue #6986 Wasm component hangs waiting for S...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2023 at 19:37):

calebschoepp opened issue #6986:

Thanks for filing a bug report! Please fill out the TODOs below.

Note: if you want to report a security issue, please read our security policy!

Test Case

problematic.wasm.zip

Steps to Reproduce

echo "<p>Random HTML</p>" > | RUST_LOG=wasmtime_wasi=trace wasmtime problematic.wasm --wasm-features component-model

Observe that component just hangs waiting for STDIN to close.

Expected Results

I expect the component to detect that STDIN has closed and print out the HTML converted to markdown.

Actual Results

Program hangs waiting for STDIN to close. Excerpt of traces:

 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview^C2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32

Versions and Environment

Wasmtime version or commit: 181d005c4

Operating system: MacOS

Architecture: M2

Extra Info

Nope

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2023 at 19:37):

calebschoepp added the bug label to Issue #6986.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2023 at 03:16):

pchickey assigned issue #6986 to pchickey.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 10 2023 at 23:55):

calebschoepp commented on issue #6986:

I spent some time trying to create a wasi integration test that reproduces this issue and was unsuccessful.

I modified the test /crates/test-programs/command-tests/src/bin/stdin.rs to use the input after reading from it just like I do in the component that is failing. I even added a sleep like I used in my component but I was unable to repro the issue in a test. I'm still very new to Wasmtime so I'm not sure what I'm doing wrong.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2023 at 17:37):

alexcrichton commented on issue #6986:

For tests they're using a different stdin than the CLI uses by default since it's an in-memory version, which may explain the difference between tests and the CLI. If the fix is to the actual stdin reading implementation then there won't be an easy way to test this right now since it would require spawning a subprocess which while we do that in tests/all/cli_tests.rs it's always done with handwritten *.wat which may be difficult to do in this case. If that's the case though it's probably ok to skip the test here.

Otherwise though a lot of I/O stuff is changing in https://github.com/bytecodealliance/wasmtime/pull/6877 so it might be good to test on that branch or test it after that lands to see if this still reproduces.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2023 at 17:57):

pchickey commented on issue #6986:

We have tests that use fork(2) to test child process stdin behavior in https://github.com/bytecodealliance/wasmtime/blob/pch/backpressure_2/crates/wasi/src/preview2/stdio.rs#L157

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2023 at 17:57):

pchickey closed issue #6986:

Thanks for filing a bug report! Please fill out the TODOs below.

Note: if you want to report a security issue, please read our security policy!

Test Case

problematic.wasm.zip

Steps to Reproduce

echo "<p>Random HTML</p>" > | RUST_LOG=wasmtime_wasi=trace wasmtime problematic.wasm --wasm-features component-model

Observe that component just hangs waiting for STDIN to close.

Expected Results

I expect the component to detect that STDIN has closed and print out the HTML converted to markdown.

Actual Results

Program hangs waiting for STDIN to close. Excerpt of traces:

 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview^C2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32

Versions and Environment

Wasmtime version or commit: 181d005c4

Operating system: MacOS

Architecture: M2

Extra Info

Nope

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2023 at 17:58):

pchickey reopened issue #6986:

Thanks for filing a bug report! Please fill out the TODOs below.

Note: if you want to report a security issue, please read our security policy!

Test Case

problematic.wasm.zip

Steps to Reproduce

echo "<p>Random HTML</p>" > | RUST_LOG=wasmtime_wasi=trace wasmtime problematic.wasm --wasm-features component-model

Observe that component just hangs waiting for STDIN to close.

Expected Results

I expect the component to detect that STDIN has closed and print out the HTML converted to markdown.

Actual Results

Program hangs waiting for STDIN to close. Excerpt of traces:

 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview^C2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32

Versions and Environment

Wasmtime version or commit: 181d005c4

Operating system: MacOS

Architecture: M2

Extra Info

Nope

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2023 at 17:58):

pchickey commented on issue #6986:

Fat finger!

view this post on Zulip Wasmtime GitHub notifications bot (Sep 19 2023 at 20:15):

alexcrichton commented on issue #6986:

Got around to looking at this after #6877 landed and there were still remaining issues which I think I've fixed in https://github.com/bytecodealliance/wasmtime/pull/7063

view this post on Zulip Wasmtime GitHub notifications bot (Sep 20 2023 at 01:19):

alexcrichton closed issue #6986:

Thanks for filing a bug report! Please fill out the TODOs below.

Note: if you want to report a security issue, please read our security policy!

Test Case

problematic.wasm.zip

Steps to Reproduce

echo "<p>Random HTML</p>" > | RUST_LOG=wasmtime_wasi=trace wasmtime problematic.wasm --wasm-features component-model

Observe that component just hangs waiting for STDIN to close.

Expected Results

I expect the component to detect that STDIN has closed and print out the HTML converted to markdown.

Actual Results

Program hangs waiting for STDIN to close. Excerpt of traces:

 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > return result=Ok(Ok(([], StreamStatus::Open)))
 TRACE wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams      > wit-bindgen import; module="streams" function="read"
 TRACE wasmtime_wasi::preview^C2::bindings::sync_io::_internal::wasi::io::streams      > call this=3 len=32

Versions and Environment

Wasmtime version or commit: 181d005c4

Operating system: MacOS

Architecture: M2

Extra Info

Nope


Last updated: Dec 23 2024 at 12:05 UTC