Keep a byobRequest held across tee() working - #7478
Merged
Merged
Conversation
Contributor
|
LGTM |
jasnell
added this pull request to stack #7480
September 22, 2026 21:23
guybedford
approved these changes
Sep 22, 2026
tee() and detach invalidated a cached byobRequest, so a source holding it across an await (a released read, then a fork) threw from respond(), erroring the stream and every branch. The spec leaves the request valid: the fork does not touch the controller's head pull-into. The controller now takes over the sole cursor's released head at the fork. byobRequest is over it until respond(), respondWithNewView(), enqueue(), error(), cancel or a closed-state respond(0) retires it; a respond enqueues its bytes, old and new, for every cursor, which drop their own copies of the old ones. C++ keeps the request working too but then breaks on the next enqueue() and drops the released read's bytes: readable-byte ledger #25. Behind the experimental typescript_implemented_streams flag.
jasnell
force-pushed
the
jasnell/ts-streams-held-byob-request-across-tee
branch
from
September 24, 2026 03:09
38e6e95 to
90c842c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tee() and detach invalidated a cached byobRequest, so a source holding it across an await (a released read, then a fork) threw from respond(), erroring the stream and every branch. The spec leaves the request valid: the fork does not touch the controller's head pull-into.
The controller now takes over the sole cursor's released head at the fork. byobRequest is over it until respond(), respondWithNewView(), enqueue(), error(), cancel or a closed-state respond(0) retires it; a respond enqueues its bytes, old and new, for every cursor, which drop their own copies of the old ones.
C++ keeps the request working too but then breaks on the next enqueue() and drops the released read's bytes: readable-byte ledger #25. Behind the experimental typescript_implemented_streams flag.
Note: this refines a previous change in one of the recent fix batches to make the behavior more correct.