Skip to content

stream: avoid mutable push in writable end callbacks - #67751

Open
rozzilla wants to merge 2 commits into
nodejs:mainfrom
rozzilla:streams-writable-onfinished-no-push
Open

rozzilla wants to merge 2 commits into
nodejs:mainfrom
rozzilla:streams-writable-onfinished-no-push

Conversation

@rozzilla

Copy link
Copy Markdown
Contributor

Similar to this PR, Writable.prototype.end() queued its callback with .push() on a private array, which looks up Array.prototype.push at call time. Replacing that method from user code made end() throw or drop the callback. Use an indexed assignment instead.

@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 Node.js streams. labels Nov 24, 2026
Writable.prototype.end() queued its callback with .push() on a private
array, which looks up Array.prototype.push at call time. Replacing that
method from user code made end() throw or drop the callback. Use an
indexed assignment instead.

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
@rozzilla
rozzilla force-pushed the streams-writable-onfinished-no-push branch from d8822ce to 01ec4e5 Compare November 24, 2026 15:36
@codecov

codecov Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.51%. Comparing base (a055d9f) to head (e9bbb30).
⚠️ Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #67751      +/-   ##
==========================================
- Coverage   90.52%   90.51%   -0.02%     
==========================================
  Files         803      805       +2     
  Lines      285110   285756     +646     
  Branches    55037    55158     +121     
==========================================
+ Hits       258101   258642     +541     
- Misses      17143    17212      +69     
- Partials     9866     9902      +36     
Files with missing lines Coverage Δ
lib/internal/streams/writable.js 98.17% <100.00%> (ø)

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

@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

Signed-off-by: Roberto Bianchi <roberto.bianchi@spendesk.com>
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. stream Issues and PRs related to Node.js streams.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants