Skip to content

stream: settle pending stream iter reads on return#63521

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

stream: settle pending stream iter reads on return#63521
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-pending-next-hang

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 23, 2026

This updates stream/iter cleanup so pending next() calls are settled when
a consumer calls return().

Previously, push() and broadcast() could leave a pending next() promise
unresolved if return() was called before any chunk was written. The cleanup
paths now resolve those pending reads with { done: true, value: undefined }.

Regression coverage was added for both push() and broadcast().

Fixes: #63519


Assisted-by: openai:gpt-5.5

Resolve pending next() calls when stream/iter push and broadcast
consumers are returned, so the promises do not remain pending after
iterator cleanup.

Fixes: nodejs#63519

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
@codecov
Copy link
Copy Markdown

codecov Bot commented May 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (dfe2d47) to head (9651061).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #63521   +/-   ##
=======================================
  Coverage   90.13%   90.13%           
=======================================
  Files         718      718           
  Lines      228399   228408    +9     
  Branches    42931    42939    +8     
=======================================
+ Hits       205860   205872   +12     
+ Misses      14283    14278    -5     
- Partials     8256     8258    +2     
Files with missing lines Coverage Δ
lib/internal/streams/iter/broadcast.js 85.25% <100.00%> (+0.01%) ⬆️
lib/internal/streams/iter/push.js 92.28% <100.00%> (+0.08%) ⬆️

... and 26 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 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: pending next() hangs after iterator return()

2 participants