Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stream: readable.resume() not allowing 'end' to be emitted after readable.unshift() #25642

Closed
mscdex opened this issue Jan 22, 2019 · 2 comments
Labels
stream Issues and PRs related to the stream subsystem.

Comments

@mscdex
Copy link
Contributor

mscdex commented Jan 22, 2019

  • Version: v10.15.0
  • Platform: n/a
  • Subsystem: stream

The test case:

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

const stream = new Readable({
  read(n) {}
});

process.nextTick(() => {
  stream.push(Buffer.alloc(1));
  stream.push(null);
});

(function checkFirstChunk() {
  var chunk = stream.read();
  if (!chunk)
    return stream.once('readable', checkFirstChunk);
  stream.unshift(chunk);
  stream.on('end', () => {
    console.log('file end');
  }).resume();
})();

On node v8.x and node master, 'file end' is logged to the console. On node v10.x, nothing is logged.

I wasn't sure if this is the same/similar underlying issue as #24474 or not, so I decided to submit this just in case.

@mscdex mscdex added the stream Issues and PRs related to the stream subsystem. label Jan 22, 2019
@mscdex
Copy link
Contributor Author

mscdex commented Jan 22, 2019

/cc @nodejs/streams

@mcollina
Copy link
Member

mcollina commented Feb 9, 2019

This was fixed in #24366, and backported in 10.15.1. Closing now.

Thanks @codebytere!

@mcollina mcollina closed this as completed Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants