Skip to content

stream: serialize concurrent share consumer reads - #63478

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:stream-iter-share-serialize
May 28, 2026
Merged

stream: serialize concurrent share consumer reads#63478
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:stream-iter-share-serialize

Conversation

@trivikr

Copy link
Copy Markdown
Member

This updates stream/itershare() consumers to serialize overlapping
next() calls from the same async iterator, preserving call order when
multiple reads are started before earlier reads resolve.

A regression test was added for the reported case where two concurrent
next() calls returned second before first.

Fixes: #63477


Assisted-by: openai:gpt-5.5

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. stream Issues and PRs related to the stream subsystem. labels May 21, 2026
@codecov

codecovBot commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.35593% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.13%. Comparing base (8d3245e) to head (1d297dc).
⚠️ Report is 72 commits behind head on main.

Files with missing linesPatch %Lines
lib/internal/streams/iter/share.js81.35%10 Missing and 1 partial ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #63478 +/- ##
==========================================
- Coverage 90.14% 90.13% -0.01% 
==========================================
Files 718 718 Lines 227984 227995 +11 Branches 42835 42829 -6 ==========================================
- Hits 205522 205513 -9 - Misses 14235 14253 +18 - Partials 8227 8229 +2 
Files with missing linesCoverage Δ
lib/internal/streams/iter/share.js84.19% <81.35%> (-1.66%)⬇️

... and 29 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.

@trivikrtrivikr added the request-ci Add this label to start a Jenkins CI on a PR. label May 22, 2026
Ensure overlapping next() calls on a single share() consumer resolve
in the same order they were requested.
Fixes: nodejs#63477
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@trivikr
trivikrforce-pushed the stream-iter-share-serialize branch from 853f1a1 to 1d297dcCompareMay 23, 2026 03:24
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 23, 2026
@nodejs-github-bot

This comment was marked as outdated.

@trivikrtrivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 24, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@trivikrtrivikr added the commit-queue Add this label to land a pull request using GitHub Actions. label May 28, 2026
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 28, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 5174c66 into nodejs:mainMay 28, 2026
73 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 5174c66

@trivikr
trivikr deleted the stream-iter-share-serialize branch May 28, 2026 18:04
aduh95 pushed a commit that referenced this pull request May 30, 2026
Ensure overlapping next() calls on a single share() consumer resolve
in the same order they were requested.
Fixes: #63477
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63478Fixes: #63477
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request May 30, 2026
Ensure overlapping next() calls on a single share() consumer resolve
in the same order they were requested.
Fixes: #63477
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63478Fixes: #63477
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 30, 2026
Ensure overlapping next() calls on a single share() consumer resolve
in the same order they were requested.
Fixes: nodejs#63477
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: nodejs#63478Fixes: nodejs#63477
Reviewed-By: James M Snell <jasnell@gmail.com>
aduh95 pushed a commit that referenced this pull request Aug 6, 2026
Ensure overlapping next() calls on a single share() consumer resolve
in the same order they were requested.
Fixes: #63477
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63478
Backport-PR-URL: #64675Fixes: #63477
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.needs-ciPRs that need a full CI run.streamIssues and PRs related to the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stream/iter: share() does not serialize overlapping next() calls on a consumer

3 participants

@trivikr@nodejs-github-bot@jasnell