Skip to content

stream: fix overlapping broadcast next calls#63500

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-broadcast-next-pending
Open

stream: fix overlapping broadcast next calls#63500
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-broadcast-next-pending

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 23, 2026

broadcast() consumers could leave an earlier next() call pending forever
when another next() was called before data became available. The later call
overwrote 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 pending
read still receives the next chunk.

Fixes: #63499


Assisted-by: openai:gpt-5.5

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
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels May 23, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. stream Issues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stream/iter: broadcast consumer can leave earlier next() pending after overlapping next() calls

2 participants