Skip to content

stream.PassThrough not draining (from Node 16) #40935

Closed
@davedoesdev

Description

@davedoesdev

Version

v16.13.0

Platform

Linux david-Latitude-E6440 5.13.0-21-generic #21-Ubuntu SMP Tue Oct 19 08:59:28 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

stream

What steps will reproduce the bug?

const { PassThrough } = require('stream');
const pt = new PassThrough({ highWaterMark: 0 });
pt.on('drain', () => console.log('drained'));
console.log(pt.write('hello'));
console.log(pt.writableLength, pt.writableNeedDrain);
console.log(pt.read().toString());
console.log(pt.writableLength, pt.writableNeedDrain);

How often does it reproduce? Is there a required condition?

Every time

What is the expected behavior?

On Node 14:

david@david-Latitude-E6440:/tmp$ node --version
v14.18.1
david@david-Latitude-E6440:/tmp$ node repro.js 
false
5 true
drained
hello
0 false

What do you see instead?

On Node 16:

david@david-Latitude-E6440:/tmp$ node --version
v16.13.0
david@david-Latitude-E6440:/tmp$ node repro.js 
false
5 true
hello
5 true

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    streamIssues and PRs related to the stream subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions