stream: fix overlapping broadcast next calls#63500
Open
trivikr wants to merge 1 commit into
Open
Conversation
Preserve the first pending broadcast consumer read when next() is called again before data is available. The overlapping read now closes the consumer without replacing the earlier resolver, allowing the pending read to receive the next chunk. Fixes: nodejs#63499 Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com> Assisted-by: openai:gpt-5.5
Collaborator
|
Review requested:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #63500 +/- ##
=======================================
Coverage 90.14% 90.15%
=======================================
Files 718 718
Lines 227984 227995 +11
Branches 42835 42832 -3
=======================================
+ Hits 205522 205550 +28
+ Misses 14235 14232 -3
+ Partials 8227 8213 -14
🚀 New features to boost your workflow:
|
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.
broadcast()consumers could leave an earliernext()call pending foreverwhen another
next()was called before data became available. The later calloverwrote the stored resolver, so the next write resolved the newer promise
instead of the older one.
This updates broadcast consumers to keep the first pending read intact. A
later overlapping
next()now closes that consumer, while the original pendingread still receives the next chunk.
Fixes: #63499
Assisted-by: openai:gpt-5.5