Skip to content

stream: handle sync writev completion in pipeTo#63561

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:stream-iter-sync-writev-undefined
Jun 1, 2026
Merged

stream: handle sync writev completion in pipeTo#63561
nodejs-github-bot merged 1 commit into
nodejs:mainfrom
trivikr:stream-iter-sync-writev-undefined

Conversation

@trivikr

@trivikr trivikr commented May 25, 2026

Copy link
Copy Markdown
Member

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

codecov Bot commented May 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.32%. Comparing base (49dcaa0) to head (825d2c9).
⚠️ Report is 72 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.

@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label May 26, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 26, 2026
@nodejs-github-bot

This comment was marked as outdated.

@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. commit-queue Add this label to land a pull request using GitHub Actions. labels May 28, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jun 1, 2026
@nodejs-github-bot nodejs-github-bot merged commit c126cbf into nodejs:main Jun 1, 2026
87 of 88 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in c126cbf

@trivikr trivikr deleted the stream-iter-sync-writev-undefined branch June 4, 2026 05: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. 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