Skip to content

stream: skip zero-byte broadcast writes#64772

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-zero-byte-broadcast
Open

stream: skip zero-byte broadcast writes#64772
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:stream-iter-zero-byte-broadcast

Conversation

@trivikr

@trivikr trivikr commented Jul 27, 2026

Copy link
Copy Markdown
Member

Fixes: #64771

This change treats zero-byte batches as successful no-ops before they reach
the broadcast buffer, matching the existing push-stream behavior. It adds
coverage for the synchronous and asynchronous single-write and vector-write
methods.


Assisted-by: codex:gpt-5.6-sol

@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 Jul 27, 2026
Zero-byte writes append entries to the broadcast buffer without
increasing bufferedBytes. This allows write('') and writev([]) to
bypass backpressure and grow the buffer without bound.

Treat zero-byte batches as successful no-ops, matching push streams,
and add coverage for the synchronous and asynchronous writer methods.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: codex:gpt-5.6-sol
@trivikr
trivikr force-pushed the stream-iter-zero-byte-broadcast branch from 8b411d6 to f8d77be Compare July 27, 2026 02:13
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Jul 27, 2026
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.14%. Comparing base (54a5095) to head (f8d77be).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #64772   +/-   ##
=======================================
  Coverage   90.14%   90.14%           
=======================================
  Files         744      744           
  Lines      242518   242523    +5     
  Branches    45685    45693    +8     
=======================================
+ Hits       218611   218624   +13     
- Misses      15396    15401    +5     
+ Partials     8511     8498   -13     
Files with missing lines Coverage Δ
lib/internal/streams/iter/broadcast.js 87.81% <100.00%> (+0.07%) ⬆️

... and 29 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. 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: zero-byte broadcast writes bypass backpressure and grow buffer unbounded

3 participants