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 pipe deadlock when starting with needDrain #36563

Closed
wants to merge 4 commits into from

Conversation

ronag
Copy link
Member

@ronag ronag commented Dec 18, 2020

Related Issues

Fixes: #36544

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

@ronag
Copy link
Member Author

ronag commented Dec 18, 2020

Missing test

@HomerSp
Copy link

HomerSp commented Dec 18, 2020

I've updated your test slightly to check for the deadlock: https://gist.github.com/bea83eb0dcbd0aea3b2689c2cd91bb38
Now it will check for the initial pause, which will happen without the fix, and also for end, which won't happen without it. I also set highWaterMark to 1 so it'll happen immediately.

@HomerSp
Copy link

HomerSp commented Dec 18, 2020

Seems like we may need to use common.mustCallAtLeast(1) instead of common.mustCall() because the latter requires it to be called exactly once, and it looks like the build system calls pause twice.

@ronag ronag requested a review from mcollina December 18, 2020 18:43
@ronag ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 18, 2020
@ronag
Copy link
Member Author

ronag commented Dec 18, 2020

@nodejs/streams

@ronag
Copy link
Member Author

ronag commented Dec 18, 2020

and it looks like the build system calls pause twice.

This was also a separate bug.

@ronag ronag requested a review from lpinca December 18, 2020 18:51
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 18, 2020
@nodejs-github-bot
Copy link
Collaborator

@ronag ronag added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 18, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 18, 2020
@nodejs-github-bot
Copy link
Collaborator

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

@ronag ronag added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Dec 18, 2020
@HomerSp
Copy link

HomerSp commented Dec 19, 2020

and it looks like the build system calls pause twice.

This was also a separate bug.

It's because pause is called when it's finishing (in unpipe) as well as in the pipe call - so your latest test code looks good to me.

@ronag
Copy link
Member Author

ronag commented Dec 20, 2020

Landed in ab895bd

@ronag ronag closed this Dec 20, 2020
ronag added a commit that referenced this pull request Dec 20, 2020
Fixes: #36544

PR-URL: #36563
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@ronag ronag mentioned this pull request Dec 20, 2020
4 tasks
targos pushed a commit that referenced this pull request Dec 21, 2020
Fixes: #36544

PR-URL: #36563
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this pull request May 1, 2021
Fixes: #36544

PR-URL: #36563
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@danielleadams danielleadams mentioned this pull request May 3, 2021
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

doc: Piping multiple streams to the same Writable stream might not end
5 participants