Skip to content

stream: serialize concurrent share consumer reads#63478

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-share-serialize
Open

stream: serialize concurrent share consumer reads#63478
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-share-serialize

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 21, 2026

This updates stream/iter share() 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-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 21, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

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).

Files with missing lines Patch % Lines
lib/internal/streams/iter/share.js 81.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 lines Coverage Δ
lib/internal/streams/iter/share.js 84.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.

@trivikr trivikr 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 trivikr force-pushed the stream-iter-share-serialize branch from 853f1a1 to 1d297dc Compare May 23, 2026 03:24
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: share() does not serialize overlapping next() calls on a consumer

2 participants