GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||
GeezerVison is showing github.com — stream: only increase awaitDrain once for each pipe destination by davedoesdev · Pull Request #7292 · nodejs/node Conversation
|
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Just curious, would a Readable suffice here?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I'd have to set its _read to a nullop.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I guess I could try doing the pushs in the _read.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
You could use new stream.Readable({read: () => {}}), but you can just leave it as a PassThrough if you prefer, I really was just curious. :)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks, generally looking good! If you want, you can add an |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@addaleax thanks for the review. I'll add a commit addressing your comments but it won't be today now. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
okay I just updated the test |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is this line actually necessary? I think the test still tests what it’s supposed to test if you leave it out, because after the push() call here awaitDrain would already be 2… right?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I wanted to test the effect (missing third buffer) rather than the cause.
In any case, awaitDrain isn't incremented until _write returns so it won't already be 2.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
/cc @nodejs/streams I’d be kind of interested in knowing whether we generally guarantee that |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Also, I’m not sure why, but this branch seems to be based on a |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
If |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
No idea why it's a month old - only forked it yesterday. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
This branch is now rebased on latest |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@addaleax I removed the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
can you please add a comment on the reason for this variable?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
also we probably wanna move up the declaration of increasedAwaitDrain to before the ondata handler is attached. i'm pretty sure that might fire sync in some cases
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Can you please format the commit message and squash the commits? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This bug is "fixed" from |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Guard against the call to write() inside pipe's ondata pushing more data back onto the Readable, thus causing ondata to be called again. This is fine but results in awaitDrain being increased more than once. The problem with that is when the destination does drain, only a single 'drain' event is emitted, so awaitDrain in this case will never reach zero and we end up with a permanently paused stream.
There was an error while loading. Please reload this page.
|
@mcollina I assume the “fixed” range corresponds to #2325 … #6023? And I’m not sure why you added |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@addaleax exactly. That means if you are depending on readable-stream@~2.0 it's fixed, and broken in readable-stream@~2.1 and readable-stream@^2.1. (I thought good first contribution was to tag possible future contributors, maybe I got it wrong) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Should be squashed and reformatted now. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
CI: https://ci.nodejs.org/job/node-test-commit/3753/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
LGTM |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in b5175e8 Thanks for fixing this bug, @davedoesdev! I believe this is your first commit to core, if so, welcome on board and we hope you find other ways to contribute! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Guard against the call to write() inside pipe's ondata pushing more data back onto the Readable, thus causing ondata to be called again. This is fine but results in awaitDrain being increased more than once. The problem with that is when the destination does drain, only a single 'drain' event is emitted, so awaitDrain in this case will never reach zero and we end up with a permanently paused stream. Fixes: #7278 PR-URL: #7292 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Guard against the call to write() inside pipe's ondata pushing more data back onto the Readable, thus causing ondata to be called again. This is fine but results in awaitDrain being increased more than once. The problem with that is when the destination does drain, only a single 'drain' event is emitted, so awaitDrain in this case will never reach zero and we end up with a permanently paused stream. Fixes: #7278 PR-URL: #7292 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
| // A readable stream which produces two buffers. | ||
| const bufs = [new Buffer(32 * 1024), new Buffer(33 * 1024)]; // above hwm | ||
| const readable = new stream.Readable({ | ||
| read: function() { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
could have been read() { ^_^
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Guard against the call to write() inside pipe's ondata pushing more data back onto the Readable, thus causing ondata to be called again. This is fine but results in awaitDrain being increased more than once. The problem with that is when the destination does drain, only a single 'drain' event is emitted, so awaitDrain in this case will never reach zero and we end up with a permanently paused stream. Fixes: #7278 PR-URL: #7292 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Guard against the call to write() inside pipe's ondata pushing more data back onto the Readable, thus causing ondata to be called again. This is fine but results in awaitDrain being increased more than once. The problem with that is when the destination does drain, only a single 'drain' event is emitted, so awaitDrain in this case will never reach zero and we end up with a permanently paused stream. Fixes: #7278 PR-URL: #7292 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Guard against the call to write() inside pipe's ondata pushing more data back onto the Readable, thus causing ondata to be called again. This is fine but results in awaitDrain being increased more than once. The problem with that is when the destination does drain, only a single 'drain' event is emitted, so awaitDrain in this case will never reach zero and we end up with a permanently paused stream. Fixes: #7278 PR-URL: #7292 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.