FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

stream: keep overlapping broadcast reads pending by trivikr · Pull Request #63500 · nodejs/node · GitHub

/ node Public

stream: keep overlapping broadcast reads pending - #63500

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:stream-iter-broadcast-next-pending
Jun 20, 2026
Merged

stream: keep overlapping broadcast reads pending#63500
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:stream-iter-broadcast-next-pending

Conversation

trivikr commented May 23, 2026

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

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 added the request-ci Add this label to start a Jenkins CI on a PR. label May 23, 2026

codecov Bot commented May 23, 2026
edited
Loading

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.92857% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.35%. Comparing base (37779fd) to head (d2bf99e).
⚠️ Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/streams/iter/broadcast.js 83.92% 9 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #63500   +/-   ##
=======================================
  Coverage   90.34%   90.35%           
=======================================
  Files         732      732           
  Lines      236689   236741   +52     
  Branches    44586    44601   +15     
=======================================
+ Hits       213839   213897   +58     
  Misses      14550    14550           
+ Partials     8300     8294    -6     
Files with missing lines Coverage Δ
lib/internal/streams/iter/broadcast.js 86.03% <83.92%> (+0.78%) ⬆️

... and 25 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 23, 2026

This comment was marked as outdated.

trivikr added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label May 23, 2026

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

This comment was marked as outdated.

trivikr force-pushed the stream-iter-broadcast-next-pending branch from 87668cb to ae779b6 Compare May 25, 2026 22:22
trivikr requested a review from jasnell May 25, 2026 22:23
trivikr force-pushed the stream-iter-broadcast-next-pending branch from ae779b6 to c556978 Compare May 25, 2026 22:24

trivikr commented May 25, 2026

Copy link
Copy Markdown
Member Author

Requested a re-review, as the previous fix incorrectly resolved the second next() while it should have been kept pending. It's now fixed in amended commit.

Details in #63499 (comment)

trivikr changed the title stream: fix overlapping broadcast next calls stream: keep overlapping broadcast reads pending May 25, 2026
trivikr force-pushed the stream-iter-broadcast-next-pending branch from c556978 to c47708d Compare May 27, 2026 01:21
trivikr added request-ci Add this label to start a Jenkins CI on a PR. and removed author ready PRs that have at least one approval, no outstanding review comments, and a CI started. labels May 27, 2026
trivikr force-pushed the stream-iter-broadcast-next-pending branch 3 times, most recently from f1aaff6 to d2bf99e Compare June 2, 2026 03:43
trivikr added review wanted PRs that need reviews. and removed review wanted PRs that need reviews. labels Jun 4, 2026
trivikr force-pushed the stream-iter-broadcast-next-pending branch 3 times, most recently from af686c7 to 1ac85e8 Compare June 13, 2026 14:06
trivikr force-pushed the stream-iter-broadcast-next-pending branch from 1ac85e8 to e35fded Compare June 15, 2026 03:53
Broadcast consumers may receive overlapping next() calls on the same
iterator. Queue those reads so chunks satisfy them in call order.

A single written chunk should resolve the earliest pending next();
later next() calls remain pending until more data is written or the
broadcast completes.

Fixes: nodejs#63499

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
trivikr force-pushed the stream-iter-broadcast-next-pending branch from e35fded to 8a996e3 Compare June 18, 2026 00:24
trivikr added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Jun 19, 2026
github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 19, 2026

This comment was marked as outdated.

This comment was marked as outdated.

Copy link
Copy Markdown
Collaborator

trivikr added the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 20, 2026
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 20, 2026
nodejs-github-bot merged commit d1eaaf6 into nodejs:main Jun 20, 2026
69 of 73 checks passed

Copy link
Copy Markdown
Collaborator

Landed in d1eaaf6

trivikr deleted the stream-iter-broadcast-next-pending branch June 20, 2026 06:49
aduh95 pushed a commit that referenced this pull request Jun 20, 2026
Broadcast consumers may receive overlapping next() calls on the same
iterator. Queue those reads so chunks satisfy them in call order.

A single written chunk should resolve the earliest pending next();
later next() calls remain pending until more data is written or the
broadcast completes.

Fixes: #63499

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63500
Fixes: #63499
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 30, 2026
Broadcast consumers may receive overlapping next() calls on the same
iterator. Queue those reads so chunks satisfy them in call order.

A single written chunk should resolve the earliest pending next();
later next() calls remain pending until more data is written or the
broadcast completes.

Fixes: nodejs#63499

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: nodejs#63500
Fixes: nodejs#63499
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 6, 2026
Broadcast consumers may receive overlapping next() calls on the same
iterator. Queue those reads so chunks satisfy them in call order.

A single written chunk should resolve the earliest pending next();
later next() calls remain pending until more data is written or the
broadcast completes.

Fixes: #63499

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63500
Backport-PR-URL: #64675
Fixes: #63499
Reviewed-By: James M Snell <jasnell@gmail.com>
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

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. needs-ci PRs that need a full CI run. 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

3 participants


Back | FazBrowse Home | New Git URL