macovedj opened PR #13891 from macovedj:dropped-stream-bug to bytecodealliance:main:
When guest streams receive
StreamResult::Droppedon their first poll (like would occur when hitting EOF), wasmtime is failing to transition fromReadState::HostReady/WriteState::HostReadytoDropped, so the hostStreamProducer/StreamConsumeris never dropped and its completion future never resolves, leaving guest awaits hung.This PR checks for
Droppedand transitions when this occurs, in the same fashion as pipe_to_guest andpipe_from_guestalready do today.I created a little repro repo here that reproduces the hang and runs clean with these changes.
macovedj requested wasmtime-core-reviewers for a review on PR #13891.
macovedj requested pchickey for a review on PR #13891.
macovedj updated PR #13891.
macovedj edited PR #13891.
alexcrichton unassigned pchickey from PR #13891 Drop host stream producers and consumers after StreamResult::Dropped.
alexcrichton requested alexcrichton for a review on PR #13891.
github-actions[bot] added the label wasmtime:api on PR #13891.
:speech_balloon: alexcrichton created PR review comment:
Similar to above could this be refactored with
pipe_to_guestto reduce duplication?
:speech_balloon: alexcrichton created PR review comment:
The handling here is I believe a duplicate (mostly) of
pipe_from_guestwhere that function handles the dropped case and this function previously didn't but now does. Would you be up for a refactor to extract the "move the state forward after an event function" to be shared between here andpipe_from_guest? That way there'd in theory be less duplication and less chance this proves an issue in the future
:memo: alexcrichton submitted PR review:
Thanks for this! I believe this is correct but I'd ideally like to refactor things to avoid duplication to prevent something like this cropping up in the future, so I'm curious on your thoughts on the below
macovedj updated PR #13891.
macovedj commented on PR #13891:
Thanks for this! I believe this is correct but I'd ideally like to refactor things to avoid duplication to prevent something like this cropping up in the future, so I'm curious on your thoughts on the below
Yep that concern makes sense to me. I just had a go at extracting it out. I'm pretty sure the logic I extracted is equivalent to what we were doing in all cases before.
:thumbs_up: alexcrichton submitted PR review.
alexcrichton has enabled auto merge for PR #13891.
alexcrichton added PR #13891 Drop host stream producers and consumers after StreamResult::Dropped to the merge queue.
:check: alexcrichton merged PR #13891.
alexcrichton removed PR #13891 Drop host stream producers and consumers after StreamResult::Dropped from the merge queue.
Last updated: Jul 29 2026 at 05:03 UTC