piping to a stream with `highWaterMark: 0` and `objectMode: false` is broken since node v20.10.0
Version
v21.6.2
Platform
Darwin x86_64
Subsystem
stream
What steps will reproduce the bug?
const { Readable, Writable } = require('stream'); const r = new Readable({ read() {} }); const w = new Writable({ highWaterMark: 0, write(chunk, encoding, callback) { console.log(chunk.toString()); callback(); }, }); r.pipe(w); r.push('hello'); r.push('world'); r.push(null);
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
In node v20.9.0 and earlier:
What do you see instead?
In node v20.10.0 and later, only the first chunk ever arrives at the destination:
Additional information
The issue is present on node v20.10.0, but is not present on v20.9.0. The issue is also present on v21.0.0.
A workaround is to use highWaterMark: 1.