Skip to content

stream: fix pipe deadlock when starting with needDrain - #36563

Closed
ronag wants to merge 4 commits into
nodejs:masterfrom
nxtedition:stream-needDrain
Closed

stream: fix pipe deadlock when starting with needDrain#36563
ronag wants to merge 4 commits into
nodejs:masterfrom
nxtedition:stream-needDrain

Conversation

@ronag

@ronagronag commented Dec 18, 2020

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

Missing test

@HomerSp

Copy link
Copy Markdown

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
Copy Markdown

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 mcollinaDecember 18, 2020 18:43
@ronagronag added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 18, 2020
@ronag

Copy link
Copy Markdown
MemberAuthor

@nodejs/streams

@ronag

Copy link
Copy Markdown
MemberAuthor

and it looks like the build system calls pause twice.

This was also a separate bug.

@ronag
ronag requested a review from lpincaDecember 18, 2020 18:51
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 18, 2020
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@ronagronag added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 18, 2020
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 18, 2020
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@mcollinamcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@ronagronag 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
Copy Markdown

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
Copy Markdown
MemberAuthor

Landed in ab895bd

@ronagronag 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>
@ronagronag 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>
@targostargos mentioned this pull request Dec 22, 2020
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>
@danielleadamsdanielleadams mentioned this pull request May 3, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs 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

@ronag@HomerSp@nodejs-github-bot@mcollina@lpinca