Skip to content

Fix lost wakeups with stdin and wasip3#12711

Open
alexcrichton wants to merge 1 commit intobytecodealliance:mainfrom
alexcrichton:fix-wakeups
Open

Fix lost wakeups with stdin and wasip3#12711
alexcrichton wants to merge 1 commit intobytecodealliance:mainfrom
alexcrichton:fix-wakeups

Conversation

@alexcrichton
Copy link
Member

I've been running some tests with wasip3 recently and I was running into a situation where a program would read stdin, get some data, and then stdin would be closed. The second read of stdin wouldn't get a wakeup and would get stuck forever despite stdin being closed. I'm not 100% sure what was happening but I'm highly suspect of the Notify-based synchronization here as I know historically that's a tricky primitive to work with. This applies a hammer and moves some lock scopes up a bit further to avoid dealing with trickiness and instead ensure everything proceeds in lockstep.

I've been running some tests with wasip3 recently and I was running into
a situation where a program would read stdin, get some data, and then
stdin would be closed. The second read of stdin wouldn't get a wakeup
and would get stuck forever despite stdin being closed. I'm not 100%
sure what was happening but I'm highly suspect of the `Notify`-based
synchronization here as I know historically that's a tricky primitive to
work with. This applies a hammer and moves some lock scopes up a bit
further to avoid dealing with trickiness and instead ensure everything
proceeds in lockstep.
@alexcrichton alexcrichton requested review from a team as code owners March 3, 2026 22:36
@alexcrichton alexcrichton requested review from pchickey and removed request for a team March 3, 2026 22:36
@github-actions github-actions bot added the wasi Issues pertaining to WASI label Mar 3, 2026
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.

1 participant