Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
import { broadcast } from 'node:stream/iter';
const { writer, broadcast: channel } = broadcast({
budget: 16_384,
backpressure: 'strict',
});
const readable = channel.push();
let accepted = 0;
while (accepted < 100_000 && writer.writevSync([])) accepted++;
console.log({ accepted, canWrite: writer.canWrite });
await writer.end();
let entries = 0;
for await (const _ of readable) entries++;
console.log({ entries });
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
{ accepted: 100000, canWrite: true }
{ entries: 0 }
Zero-byte writes should be accepted as no-ops and create no buffer entries, preventing unbounded growth.
From specification §13.1.2 Broadcast backpressure
The shared buffer cannot overwrite entries that the slowest consumer has not yet read.
What do you see instead?
{ accepted: 100000, canWrite: true }
{ entries: 100000 }
All 100,000 empty batches are buffered.
Additional information
No response
Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Zero-byte writes should be accepted as no-ops and create no buffer entries, preventing unbounded growth.
From specification §13.1.2 Broadcast backpressure
What do you see instead?
All 100,000 empty batches are buffered.
Additional information
No response