Skip to content

stream: settle pending stream iter reads on return#63521

Open
trivikr wants to merge 2 commits into
nodejs:mainfrom
trivikr:stream-iter-pending-next-hang
Open

stream: settle pending stream iter reads on return#63521
trivikr wants to merge 2 commits 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

@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.32%. Comparing base (92f48f4) to head (4c2a5f1).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63521      +/-   ##
==========================================
+ Coverage   90.31%   90.32%   +0.01%     
==========================================
  Files         730      730              
  Lines      234653   234662       +9     
  Branches    43952    43954       +2     
==========================================
+ Hits       211926   211970      +44     
+ Misses      14474    14420      -54     
- Partials     8253     8272      +19     
Files with missing lines Coverage Δ
lib/internal/streams/iter/broadcast.js 85.25% <100.00%> (+0.01%) ⬆️
lib/internal/streams/iter/push.js 92.09% <100.00%> (+0.08%) ⬆️

... and 32 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
Comment thread lib/internal/streams/iter/push.js Outdated
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 23, 2026
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

@trivikr trivikr added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels May 24, 2026
@trivikr

This comment was marked as outdated.

@trivikr trivikr marked this pull request as draft May 24, 2026 04:19
@trivikr trivikr marked this pull request as ready for review May 26, 2026 17:22
@trivikr trivikr added request-ci Add this label to start a Jenkins CI on a PR. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels May 27, 2026
trivikr and others added 2 commits May 27, 2026 08:39
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
Co-authored-by: James M Snell <jasnell@gmail.com>
@trivikr trivikr force-pushed the stream-iter-pending-next-hang branch from 4c2a5f1 to f4a87a4 Compare May 27, 2026 16:02
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 pending requests for changes, and a CI started. 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()

3 participants