-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Another pipe() deadlock since v14.17 #48666
Labels
stream
Issues and PRs related to the stream subsystem.
Comments
FYI, this is not just a theoretical issue, but can occur in real code (which is why I found it). For my code, the issue shows itself when a http download is "fast". |
Hmm, I tried to workaround this issue by using |
@nodejs/streams |
ronag
added a commit
to nxtedition/node
that referenced
this issue
Jul 7, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: nodejs#48666
ronag
added a commit
to nxtedition/node
that referenced
this issue
Jul 7, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: nodejs#48666
ronag
added a commit
to nxtedition/node
that referenced
this issue
Jul 7, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: nodejs#48666
ronag
added a commit
to nxtedition/node
that referenced
this issue
Jul 7, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: nodejs#48666
ronag
added a commit
to nxtedition/node
that referenced
this issue
Jul 7, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: nodejs#48666
ronag
added a commit
to nxtedition/node
that referenced
this issue
Jul 10, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: nodejs#48666 PR-URL: nodejs#48691
nodejs-github-bot
pushed a commit
that referenced
this issue
Jul 12, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: #48666 PR-URL: #48691 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
juanarbol
pushed a commit
that referenced
this issue
Jul 13, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: #48666 PR-URL: #48691 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Ceres6
pushed a commit
to Ceres6/node
that referenced
this issue
Aug 14, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: nodejs#48666 PR-URL: nodejs#48691 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
Ceres6
pushed a commit
to Ceres6/node
that referenced
this issue
Aug 14, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: nodejs#48666 PR-URL: nodejs#48691 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
kanongil
pushed a commit
to kanongil/node-1
that referenced
this issue
Aug 25, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: nodejs#48666 PR-URL: nodejs#48691 Backport-PR-URL: nodejs#49323 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
ruyadorno
pushed a commit
that referenced
this issue
Sep 8, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: #48666 PR-URL: #48691 Backport-PR-URL: #49323 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
ruyadorno
pushed a commit
that referenced
this issue
Sep 13, 2023
When piping a paused Readable to a full Writable we didn't register a drain listener which cause the src to never resume. Refs: #48666 PR-URL: #48691 Backport-PR-URL: #49323 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
This issue has been fixed in v20.5. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Version
v20.3.1
Platform
Darwin silmaril.home 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:19 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T8103 arm64
Subsystem
stream
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
100% for test code since node v14.17.0.
This seems to be a corner case that depends on:
What is the expected behavior? Why is that the expected behavior?
Stream starts flowing and drains through the writable:
What do you see instead?
Stream deadlocks:
Additional information
#36563 fixes a another pipe deadlock introduced in #35348. This was introduced in v16.0 and backported to v14 in v14.17. However, the fix is not complete, and
pipe()
can still deadlock as demonstrated!I expect the issue is caused by the conditional calling of
pause()
here:node/lib/internal/streams/readable.js
Lines 835 to 838 in c47ea21
To verify this, I tried to call
src.resume()
right before the call tosrc.pipe()
. This makesstate.flowing === true
, and ensurespause()
is called.As far I can tell, this issue is present in all active and maintenance release lines, and was introduced into v14 during the LTS cycle. This will likely also affect the current readable-stream.
Until this is fixed, or for anyone still using v14 (and possibly v16 depending on how critical a fix is regarded), a workaround is to always call
stream.resume()
before callingstream.pipe()
.The text was updated successfully, but these errors were encountered: