-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
wasmtime/crates/wasi/src/tcp.rs
Lines 719 to 723 in 6767488
| // Failing with `EWOULDBLOCK` is how we differentiate between a closed channel and no | |
| // data to read right now. | |
| Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => 0, | |
Returning 0 for std::io::ErrorKind::WouldBlock causes downstream to interpret it as a closed stream, see:
bytecodealliance/wstd#25 (comment).
https://github.com/yoshuawuyts/wstd/blob/5ce367add5e7bcb569b6487453cb9ba94468dc99/src/io/copy.rs#L12
This is also found in:
wasmtime/crates/test-programs/src/bin/preview2_tcp_streams.rs
Lines 17 to 22 in 6767488
| // The input stream should immediately signal StreamError::Closed. | |
| // Notably, it should _not_ return an empty list (the wasi-io equivalent of EWOULDBLOCK) | |
| // See: https://github.com/bytecodealliance/wasmtime/pull/8968 | |
| assert!(matches!(client.input.read(10), Err(StreamError::Closed))); | |
Given that the wit files already include many would-block errors, would it make sense to extend stream-error to include a would-block?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels