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: fix readable being emitted when nothing to do #18372

Closed
wants to merge 1 commit into from

Conversation

mafintosh
Copy link
Member

@mafintosh mafintosh commented Jan 25, 2018

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines
Affected core subsystem(s)

stream

This fixes an issue introduced by #17979 where the readable event are sometimes emitted when the stream is neither readable nor has it ended.

@nodejs-github-bot nodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label Jan 25, 2018
@mafintosh
Copy link
Member Author

/cc @mcollina @nodejs/streams

@mcollina
Copy link
Member

CITGM seems similar to master, landing.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mcollina
Copy link
Member

Landed as 0778f79.

@mcollina mcollina closed this Jan 29, 2018
mcollina pushed a commit that referenced this pull request Jan 29, 2018
Fixes a regression introduced by the once-per-microtick 'readable'
event emission.

See: #17979
PR-URL: #18372
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
@mafintosh mafintosh deleted the fix-readable-event branch January 30, 2018 08:10
MoonBall pushed a commit to MoonBall/node that referenced this pull request Feb 5, 2018
The original test case hides the underlying cause by using
`PassThrough`. This change adds a test case for the underlying cause.
This makes it clearer and easier to be understood.

Refs: nodejs#18372
mcollina pushed a commit that referenced this pull request Feb 8, 2018
The original test case hides the underlying cause by using
`PassThrough`. This change adds a test case for the underlying cause.
This makes it clearer and easier to be understood.

Refs: #18372

PR-URL: #18575
Reviewed-By: Matteo Collina <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
Fixes a regression introduced by the once-per-microtick 'readable'
event emission.

See: nodejs#17979
PR-URL: nodejs#18372
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
MayaLekova pushed a commit to MayaLekova/node that referenced this pull request May 8, 2018
The original test case hides the underlying cause by using
`PassThrough`. This change adds a test case for the underlying cause.
This makes it clearer and easier to be understood.

Refs: nodejs#18372

PR-URL: nodejs#18575
Reviewed-By: Matteo Collina <[email protected]>
lundibundi added a commit to lundibundi/node that referenced this pull request Aug 10, 2018
Avoid trying to emit 'readable' due to the fact that
state.length is always >= state.highWaterMark if highWaterMark is 0.
Therefore upon .read(0) call (through .on('readable')) stream assumed
that it has enough data to emit 'readable' even though
state.length === 0 instead of issuing _read(). Which led to the TTY
not recognizing that someone is waiting for the input.

Fixes: nodejs#20503
Refs: nodejs#18372
mcollina pushed a commit that referenced this pull request Aug 10, 2018
Avoid trying to emit 'readable' due to the fact that
state.length is always >= state.highWaterMark if highWaterMark is 0.
Therefore upon .read(0) call (through .on('readable')) stream assumed
that it has enough data to emit 'readable' even though
state.length === 0 instead of issuing _read(). Which led to the TTY
not recognizing that someone is waiting for the input.

Fixes: #20503
Refs: #18372

PR-URL: #21690
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
targos pushed a commit that referenced this pull request Aug 11, 2018
Avoid trying to emit 'readable' due to the fact that
state.length is always >= state.highWaterMark if highWaterMark is 0.
Therefore upon .read(0) call (through .on('readable')) stream assumed
that it has enough data to emit 'readable' even though
state.length === 0 instead of issuing _read(). Which led to the TTY
not recognizing that someone is waiting for the input.

Fixes: #20503
Refs: #18372

PR-URL: #21690
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
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

Successfully merging this pull request may close these issues.

4 participants