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: sync stream unpipe resume #31191

Closed
wants to merge 4 commits into from

Conversation

ronag
Copy link
Member

@ronag ronag commented Jan 5, 2020

pipe() ondata should not control flow state if cleaned up.

Fixes: #31190

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

pipe() ondata should not control flow state if cleaned up.

Fixes: nodejs#31190
@nodejs-github-bot nodejs-github-bot added the stream Issues and PRs related to the stream subsystem. label Jan 5, 2020
@ronag
Copy link
Member Author

ronag commented Jan 5, 2020

The problem here is that we call unpipe() and then resume(). resume() will schedule a resume_ in the next tick. However, before that a 'data' event is emitted causing ondata to explicitly pause the stream, which stops resume_ from re-flowing the stream.

Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

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

LGTM if CI (and linter) are green

test/parallel/test-stream-readable-unpipe-resume.js Outdated Show resolved Hide resolved
@ronag ronag force-pushed the stream-readable-unpipe-resume branch from 801fa99 to 786fcbb Compare January 5, 2020 11:06
@ronag ronag force-pushed the stream-readable-unpipe-resume branch from 786fcbb to c9cd445 Compare January 5, 2020 11:07
@nodejs-github-bot
Copy link
Collaborator

@BridgeAR BridgeAR added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jan 6, 2020
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

@addaleax
Copy link
Member

addaleax commented Jan 7, 2020

Landed in b9e6c1b :)

@addaleax addaleax closed this Jan 7, 2020
addaleax pushed a commit that referenced this pull request Jan 7, 2020
pipe() ondata should not control flow state if cleaned up.

Fixes: #31190

PR-URL: #31191
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 16, 2020
pipe() ondata should not control flow state if cleaned up.

Fixes: #31190

PR-URL: #31191
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@codebytere codebytere mentioned this pull request Jan 16, 2020
@codebytere
Copy link
Member

@ronag this looks like it'll need a manual backport to v12.x, if we think it should land there. I'll add the label but feel free to swap it!

@ronag
Copy link
Member Author

ronag commented Mar 14, 2020

@codebytere: #32264

MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Apr 1, 2020
pipe() ondata should not control flow state if cleaned up.

Fixes: nodejs#31190

Backport-PR-URL: nodejs#32264
PR-URL: nodejs#31191
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
ronag added a commit to nxtedition/node that referenced this pull request Apr 1, 2020
pipe() ondata should not control flow state if cleaned up.

Fixes: nodejs#31190

PR-URL: nodejs#31191
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Backport-PR-URL: nodejs#32264
MylesBorins pushed a commit that referenced this pull request Apr 1, 2020
pipe() ondata should not control flow state if cleaned up.

Fixes: #31190

Backport-PR-URL: #32264
PR-URL: #31191
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Backport-PR-URL: #32264
@codebytere codebytere mentioned this pull request Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. stream Issues and PRs related to the stream subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

unpipe() and resume() in _transform()
9 participants