Skip to content

Readable stops readingΒ #26097

@lpinca

Description

@lpinca
  • Version: >= 10.0.0
  • Platform: any
  • Subsystem: stream

Consider the following example, born from discussion in #25969.

const { Readable } = require('stream');

const buf = Buffer.alloc(8192);

const readable = new Readable({
  read() {
    this.push(buf);
  }
});

readable.on('readable', function() {
  const data = readable.read();
  console.log(data.length);
});

Note that readable.read() is not called in a loop on purpose.

Expected behavior

An endless loop. This works as expected in Node.js < 10.0.0.

Actual behavior

Reading stops after a few reads.


Bisecting points to this commit: 0778f79.

Metadata

Metadata

Assignees

No one assigned

    Labels

    streamIssues and PRs related to the stream subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions