Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
stream: avoid pause with unpipe in buffered write#2325
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
LinusU commented Aug 14, 2015
@mscdex This fixes the problem, thank you so much, would love to see this landed 💯 👍 I'm currently using this as a workaround. Is it stupid as fuck or should it work? functiondone(err){if(isDone)returnisDone=truereq.unpipe(busboy)req.resume()busboy.removeAllListeners()/* Work around bug in Node.js * https://github.com/nodejs/node/issues/2323 */setImmediate(function(){if(req._readableState.awaitDrain===1){req._readableState.awaitDrain--req.resume()}})onFinished(req,function(){next(err)})}I'm also having some trouble which forces me to add the Again, thank you for the quick help! |
mscdex commented Aug 15, 2015
/cc @nodejs/streams |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the significants of this number, is it being used to bust the buffer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was copied from the test case in #2323. I think the point though is to fill up the internal buffer to cause the write() to return false.
LinusU commented Aug 29, 2015
If someone could help me to find a workaround for earlier Node versions (preferably back to 0.10) that would be very much appreciated. I've tried here: expressjs/multer#205 |
37b7ff1 to bcc79ebComparemscdex commented Sep 10, 2015
Ok, updated PR according to suggestions. |
Fishrock123 commented Sep 14, 2015
9b13ecb to b879ce0Comparemscdex commented Oct 11, 2015
updated to use CI: https://ci.nodejs.org/job/node-test-commit/799/ Does this look good to land now? |
thefourtheye commented Oct 11, 2015
There can be a comment which explains the importance of |
b879ce0 to 6176c8bCompareIf a pipe is cleaned up (due to unpipe) during a write that returned false, the source stream can get stuck in a paused state. Fixes: nodejs#2323
6176c8b to 91819e0CompareIf a pipe is cleaned up (due to unpipe) during a write that returned false, the source stream can get stuck in a paused state. Fixes: #2323 PR-URL: #2325 Reviewed-By: Sakthipriyan Vairamani <[email protected]>
mscdex commented Oct 11, 2015
Landed in 6899094. |
If a pipe is cleaned up (due to unpipe) during a write that returned false, the source stream can get stuck in a paused state. Fixes: nodejs#2323 PR-URL: nodejs#2325 Reviewed-By: Sakthipriyan Vairamani <[email protected]>
LinusU commented Oct 12, 2015
Nice, thanks! |
If a pipe is cleaned up (due to unpipe) during a write that returned false, the source stream can get stuck in a paused state. Fixes: #2323 PR-URL: #2325 Reviewed-By: Sakthipriyan Vairamani <[email protected]>
jasnell commented Oct 12, 2015
Landed in v4.x in 7b9f78a |
omrilitov commented Oct 26, 2015
Is this fixed in v4.2.0? |
mscdex commented Oct 26, 2015
@omrilitov It's included in v4.2.0. |
In 6899094 (nodejs#2325), the conditions for increasing `readableState.awaitDrain` when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving `readableState.awaitDrain` with a constant value of 0. This patch changes the conditions to testing whether the stream for which `.write()` returned false is still a piping destination, which was likely the intention of the original patch. Fixes: nodejs#5820
In 6899094 (#2325), the conditions for increasing `readableState.awaitDrain` when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving `readableState.awaitDrain` with a constant value of 0. This patch changes the conditions to testing whether the stream for which `.write()` returned false is still a piping destination, which was likely the intention of the original patch. Fixes: #5820Fixes: #5257 PR-URL: #6023 Reviewed-By: Brian White <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
In 6899094 (#2325), the conditions for increasing `readableState.awaitDrain` when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving `readableState.awaitDrain` with a constant value of 0. This patch changes the conditions to testing whether the stream for which `.write()` returned false is still a piping destination, which was likely the intention of the original patch. Fixes: #5820Fixes: #5257 PR-URL: #6023 Reviewed-By: Brian White <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
In 6899094 (#2325), the conditions for increasing `readableState.awaitDrain` when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving `readableState.awaitDrain` with a constant value of 0. This patch changes the conditions to testing whether the stream for which `.write()` returned false is still a piping destination, which was likely the intention of the original patch. Fixes: #5820Fixes: #5257 PR-URL: #6023 Reviewed-By: Brian White <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
In 6899094 (#2325), the conditions for increasing `readableState.awaitDrain` when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving `readableState.awaitDrain` with a constant value of 0. This patch changes the conditions to testing whether the stream for which `.write()` returned false is still a piping destination, which was likely the intention of the original patch. Fixes: #5820Fixes: #5257 PR-URL: #6023 Reviewed-By: Brian White <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
In 6899094 (#2325), the conditions for increasing `readableState.awaitDrain` when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving `readableState.awaitDrain` with a constant value of 0. This patch changes the conditions to testing whether the stream for which `.write()` returned false is still a piping destination, which was likely the intention of the original patch. Fixes: #5820Fixes: #5257 PR-URL: #6023 Reviewed-By: Brian White <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
In 6899094 (#2325), the conditions for increasing `readableState.awaitDrain` when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving `readableState.awaitDrain` with a constant value of 0. This patch changes the conditions to testing whether the stream for which `.write()` returned false is still a piping destination, which was likely the intention of the original patch. Fixes: #5820Fixes: #5257 PR-URL: #6023 Reviewed-By: Brian White <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
In 6899094 (#2325), the conditions for increasing `readableState.awaitDrain` when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving `readableState.awaitDrain` with a constant value of 0. This patch changes the conditions to testing whether the stream for which `.write()` returned false is still a piping destination, which was likely the intention of the original patch. Fixes: #5820Fixes: #5257 PR-URL: #6023 Reviewed-By: Brian White <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
In 6899094 (#2325), the conditions for increasing `readableState.awaitDrain` when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving `readableState.awaitDrain` with a constant value of 0. This patch changes the conditions to testing whether the stream for which `.write()` returned false is still a piping destination, which was likely the intention of the original patch. Fixes: #5820Fixes: #5257 PR-URL: #6023 Reviewed-By: Brian White <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]>
If a pipe is cleaned up (due to unpipe) during a failed write(),
the source stream can get stuck in a paused state.
Fixes: #2323