Skip to content

stream: handle sync writev completion in pipeTo#63561

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-sync-writev-undefined
Open

stream: handle sync writev completion in pipeTo#63561
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-sync-writev-undefined

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented May 25, 2026

Fixes: #63560

Fixes stream/iter pipeTo() when a duck-typed writer accepts a batched
writev() synchronously and returns undefined.

pipeTo() already tolerated undefined from single write() calls, but the
writev() path passed the return value directly to PromisePrototypeThen(),
which caused a TypeError for synchronous completion.


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 25, 2026
Treat writer.writev() returning undefined as synchronous success to
match the existing write() fallback behavior for duck-typed writers.
This avoids calling Promise.prototype.then on undefined after a batch
write has already been accepted.

Fixes: nodejs#63560

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: openai:gpt-5.5
@trivikr trivikr force-pushed the stream-iter-sync-writev-undefined branch from 13ee76d to 825d2c9 Compare May 25, 2026 16:51
@codecov
Copy link
Copy Markdown

codecov Bot commented May 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.32%. Comparing base (49dcaa0) to head (825d2c9).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #63561      +/-   ##
==========================================
- Coverage   90.33%   90.32%   -0.02%     
==========================================
  Files         730      730              
  Lines      234362   234472     +110     
  Branches    43906    43916      +10     
==========================================
+ Hits       211713   211781      +68     
- Misses      14371    14433      +62     
+ Partials     8278     8258      -20     
Files with missing lines Coverage Δ
lib/internal/streams/iter/pull.js 88.21% <100.00%> (+0.09%) ⬆️

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

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 the stream subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stream/iter: pipeTo() crashes when synchronous writev() returns undefined

3 participants