Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
Open
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.
Description
Version
16.14.2
Platform
x64
Subsystem
No response
What steps will reproduce the bug?
asyncfunctionstart(){const{ Transform }=require('stream');consttransformStream=newTransform({objectMode: true,highWaterMark: 0,transform(item,enc,callback){console.error("writing",item);this.push(item);callback();}});transformStream.write('hello1');transformStream.write('hello2');transformStream.write('hello3');transformStream.write('hello4');transformStream.write('hello5');transformStream.write('hello6');transformStream.write('hello7');transformStream.write('hello8');transformStream.write('hello9');transformStream.end();forawait(consttextoftransformStream){awaitwait();console.error(text);}};asyncfunctionwait(){returnnewPromise(resolve=>{setTimeout(()=>resolve(),1000);});}start();I wouldn't expect the transform method to be called, while the highWaterMark is already reached.
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior?
Node 14 and older, backpressure is handled properly (even with highWaterMark: 0):
Expected output:
writing hello1writing hello2hello1hello2writing hello3hello3writing hello4hello4writing hello5hello5writing hello6hello6writing hello7hello7writing hello8hello8writing hello9hello9What do you see instead?
PS > node .\backpressure.jswriting hello1writing hello2writing hello3writing hello4writing hello5writing hello6writing hello7writing hello8writing hello9hello1hello2hello3hello4hello5hello6hello7hello8hello9Additional information
When using highWaterMark: 1 in Node 16.x, backpressure works as expected again.
Did anything change around using highWaterMark:0 in Node16? It doesn't seem backwards compatible.
Metadata
Metadata
Assignees
Labels
streamIssues and PRs related to the stream subsystem.Issues and PRs related to the stream subsystem.