Skip to content

stream.resume() doesn't make the stream flowing after removing readable listener #24281

Closed
@snakamura

Description

@snakamura
  • Version: v10.13.0
  • Platform: Darwin planata.local 17.7.0 Darwin Kernel Version 17.7.0: Wed Oct 10 23:06:14 PDT 2018; root:xnu-4570.71.13~1/RELEASE_X86_64 x86_64 i386 MacBookPro14,2 Darwin
  • Subsystem: stream

With v10.13.0, stream.resume() doesn't make the stream flowing after removing readable listener. Here is a code to demonstrate the problem.

'use strict';

const fs = require('fs');

const s = fs.createReadStream('s.js');

const readableListener = () => console.log('readable');
s.on('readable', readableListener);
s.on('end', () => console.log('end'));
s.removeListener('readable', readableListener);
s.resume();

Note that you need to name this script s.js to run this script without any changes.

With v10.13.0, this prints nothing. With v8.12.0, this prints end. This seems to be related to #18994, #21696 and #22209, but I'm not sure if this is an intentional change.

Note that a stream starts flowing when I add data listener instead of calling resume.

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.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