Skip to content

stream: abort pending single-source merge reads#64445

Open
trivikr wants to merge 3 commits into
nodejs:mainfrom
trivikr:stream-iter-single-source-merge-abort-pending-read
Open

stream: abort pending single-source merge reads#64445
trivikr wants to merge 3 commits into
nodejs:mainfrom
trivikr:stream-iter-single-source-merge-abort-pending-read

Conversation

@trivikr

@trivikr trivikr commented Jul 12, 2026

Copy link
Copy Markdown
Member

Fixes: #64444

The single-source merge() path uses a plain for await loop, so aborting
during a pending read neither rejects next() nor closes the source iterator.

Make the single-source path abort-aware before normalization so cancellation
reaches the active source iterator. Also allow the shared abort cleanup helper
to handle iterators whose return() method returns a synchronous iterator
result.

Make the single-source merge path abort-aware so signal cancellation
rejects a pending read and closes the active source iterator.

Handle synchronous iterator return values when marking aborted cleanup
as handled.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
@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 Jul 12, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 12, 2026
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.23%. Comparing base (14166a5) to head (1ee6017).
⚠️ Report is 12 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main   #64445    +/-   ##
========================================
  Coverage   90.23%   90.23%            
========================================
  Files         741      741            
  Lines      241375   241609   +234     
  Branches    45483    45592   +109     
========================================
+ Hits       217800   218026   +226     
- Misses      15129    15148    +19     
+ Partials     8446     8435    -11     
Files with missing lines Coverage Δ
lib/internal/streams/iter/consumers.js 96.64% <100.00%> (+0.01%) ⬆️
lib/internal/streams/iter/utils.js 98.22% <100.00%> (+0.01%) ⬆️

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

Comment thread lib/internal/streams/iter/utils.js
Comment thread test/parallel/test-stream-iter-consumers-merge.js
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 12, 2026
@nodejs-github-bot

This comment was marked as outdated.

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 12, 2026
@trivikr

trivikr commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

cc @jasnell I added comments as suggested.

Can you please re-approve so that CI can be run?

@trivikr trivikr force-pushed the stream-iter-single-source-merge-abort-pending-read branch from 5fac436 to 1ee6017 Compare July 12, 2026 20:22
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: merge() does not abort pending read for a single source

4 participants