Skip to content

wasi/pipe: fix AsyncReadStream returning empty list when closed#12816

Open
vavrusa wants to merge 1 commit intobytecodealliance:mainfrom
vavrusa:marek/fix-stream-read-after-closed
Open

wasi/pipe: fix AsyncReadStream returning empty list when closed#12816
vavrusa wants to merge 1 commit intobytecodealliance:mainfrom
vavrusa:marek/fix-stream-read-after-closed

Conversation

@vavrusa
Copy link

@vavrusa vavrusa commented Mar 21, 2026

Hi! This is part of an issue I was trying to debug.

After the inner stream returns 0 the StreamError::Closed is sent to the channel, and after picking it up in read() the stream is set as closed, and the error is returned to the caller.

If the caller however tries to recv() after the socket is closed, AsyncReadStream is going to return empty list and not StreamError::Closed which is ambiguous.

After the inner stream returns `0` the StreamError::Closed is sent to
the channel, and after picking it up in read() the stream is set as closed,
and the error is returned to the caller.

If the caller however tries to recv() after the socket is closed, AsyncReadStream
is going to return empty list and not StreamError::Closed which is ambiguous.
@vavrusa vavrusa requested a review from a team as a code owner March 21, 2026 05:23
@github-actions github-actions bot added the wasi Issues pertaining to WASI label Mar 21, 2026
@alexcrichton
Copy link
Member

Thanks! Would it be possible to add a test for this too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasi Issues pertaining to WASI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants