Skip to content

stream: refine stream/iter backpressure and error handling - #63697

Merged
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
jasnell:jasnell/refine-stream-iter-backpressure
Jun 17, 2026
Merged

stream: refine stream/iter backpressure and error handling#63697
nodejs-github-bot merged 2 commits into
nodejs:mainfrom
jasnell:jasnell/refine-stream-iter-backpressure

Conversation

@jasnell

@jasnell jasnell commented Jun 1, 2026

Copy link
Copy Markdown
Member
  • Improve the backpressure implementation alignment with the spec.
  • Improve error handling in a couple cases.

@jasnell
jasnell requested review from mcollina and trivikr June 1, 2026 16:22
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/streams

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. labels Jun 1, 2026
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.01887% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.35%. Comparing base (faa413e) to head (28142cd).
⚠️ Report is 39 commits behind head on main.

Files with missing lines Patch % Lines
lib/internal/streams/iter/classic.js 62.50% 6 Missing ⚠️
lib/internal/streams/iter/consumers.js 91.42% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63697      +/-   ##
==========================================
- Coverage   91.96%   90.35%   -1.62%     
==========================================
  Files         379      732     +353     
  Lines      166659   236588   +69929     
  Branches    25502    44567   +19065     
==========================================
+ Hits       153270   213763   +60493     
- Misses      13100    14544    +1444     
- Partials      289     8281    +7992     
Files with missing lines Coverage Δ
lib/internal/streams/iter/pull.js 88.23% <ø> (+0.02%) ⬆️
lib/internal/streams/iter/push.js 90.84% <100.00%> (-0.79%) ⬇️
lib/internal/streams/iter/types.js 100.00% <ø> (ø)
lib/internal/streams/iter/consumers.js 96.76% <91.42%> (+0.15%) ⬆️
lib/internal/streams/iter/classic.js 89.26% <62.50%> (+0.35%) ⬆️

... and 478 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/classic.js
Comment thread lib/internal/streams/iter/consumers.js Outdated
Comment thread lib/internal/streams/iter/consumers.js Outdated
Comment thread lib/internal/streams/iter/push.js
@jasnell
jasnell force-pushed the jasnell/refine-stream-iter-backpressure branch from bea41b1 to 28142cd Compare June 2, 2026 11:45
@jasnell
jasnell requested a review from trivikr June 2, 2026 11:45
@jasnell jasnell changed the title Jasnell/refine stream iter backpressure stream: refine stream/iter backpressure and error handling Jun 2, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jun 2, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 2, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@trivikr trivikr added the author ready PRs with CI started, the required approvals, and no outstanding review comments. label Jun 6, 2026
jasnell added 2 commits June 8, 2026 18:25
In `Writer`, there are two queues that matter: the slot queue
and the pending queue. The sync `writeSync`/`writevSync` only
use the slot queue. If writes cannot be accepted directly into
slots, they return `false`. The sync methods *never* enqueue
into the pending queue. The async `write`/`writev` will first
attempt to add to the slot queue; if it is full, then it will
attempt to add to the pending queue; if that is also full, the
backpressure policy kicks in.

Signed-off-by: James M Snell <jasnell@gmail.com>
Signed-off-by: James M Snell <jasnell@gmail.com>
@trivikr
trivikr force-pushed the jasnell/refine-stream-iter-backpressure branch from 28142cd to c29567e Compare June 9, 2026 01:28

@trivikr trivikr 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.

Rebased after resolving conflicts with #63564

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

trivikr commented Jun 9, 2026

Copy link
Copy Markdown
Member

Since I rebased the changes to resolve conflict, this needs approval from another reviewer for CI to start.

@trivikr trivikr added review wanted PRs that need review. and removed author ready PRs with CI started, the required approvals, and no outstanding review comments. review wanted PRs that need review. labels Jun 9, 2026
@trivikr trivikr added the review wanted PRs that need review. label Jun 16, 2026

@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

@mcollina mcollina added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Jun 17, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jun 17, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@gurgunday gurgunday 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 commit-queue-squash PRs the Commit Queue should land as one squashed commit. commit-queue PRs queued for automated landing through the Commit Queue. labels Jun 17, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Jun 17, 2026
@nodejs-github-bot
nodejs-github-bot merged commit b03e6e0 into nodejs:main Jun 17, 2026
95 of 96 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in b03e6e0

aduh95 pushed a commit that referenced this pull request Jun 18, 2026
In `Writer`, there are two queues that matter: the slot queue
and the pending queue. The sync `writeSync`/`writevSync` only
use the slot queue. If writes cannot be accepted directly into
slots, they return `false`. The sync methods *never* enqueue
into the pending queue. The async `write`/`writev` will first
attempt to add to the slot queue; if it is full, then it will
attempt to add to the pending queue; if that is also full, the
backpressure policy kicks in.

Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: #63697
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
aduh95 pushed a commit to aduh95/node that referenced this pull request Jul 30, 2026
In `Writer`, there are two queues that matter: the slot queue
and the pending queue. The sync `writeSync`/`writevSync` only
use the slot queue. If writes cannot be accepted directly into
slots, they return `false`. The sync methods *never* enqueue
into the pending queue. The async `write`/`writev` will first
attempt to add to the slot queue; if it is full, then it will
attempt to add to the pending queue; if that is also full, the
backpressure policy kicks in.

Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#63697
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
aduh95 pushed a commit that referenced this pull request Aug 6, 2026
In `Writer`, there are two queues that matter: the slot queue
and the pending queue. The sync `writeSync`/`writevSync` only
use the slot queue. If writes cannot be accepted directly into
slots, they return `false`. The sync methods *never* enqueue
into the pending queue. The async `write`/`writev` will first
attempt to add to the slot queue; if it is full, then it will
attempt to add to the pending queue; if that is also full, the
backpressure policy kicks in.

Signed-off-by: James M Snell <jasnell@gmail.com>
PR-URL: #63697
Backport-PR-URL: #64675
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commit-queue-squash PRs the Commit Queue should land as one squashed commit. lib / src Issues and PRs involving general changes in the lib/ or src/ directories. needs-ci PRs that need a full CI run. review wanted PRs that need review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants