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: 'readable' have precedence over flowing by mcollina · Pull Request #18994 · nodejs/node Conversation
Member
In Streams3 the 'readable' event/.read() method had a lower precedence Fixes: #18058 Checklist
Affected core subsystem(s)stream, http
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
mcollina
force-pushed
the
readable-and-data
branch
from
c2fb53b to
53ef8f2
Compare
|
There was an error while loading. Please reload this page.
|
CI: https://ci.nodejs.org/job/node-test-pull-request/13369/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Wouldn't |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mscdex you are right. I didn't account for https://github.com/nodejs/node/blob/master/lib/events.js#L324-L336. Do you think I can just listen for |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mcollina so basically just suspends flowing when readable is set? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mafintosh that's the goal yes. It also restores the behavior after |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@mcollina wondering if we should even fix this. the same behaivor described in the issue would happen if there are two consumers of the readable event anyway (which is what happens in flowing mode). not too much of a fan of implicit event listener side effects |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I am good with not fixing it. But it’s a discussion to have. This fixed a major usability problem if you want to have both a on(‘data’) and on(‘readable’)/read() at the same time (with pipe) read() will always return null. I’m ok if we want to remove the resume side effect when removing ‘readable’, as that might be confusing. However we should really be updating readableListening: this is also a bug without the fix for read() itself. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Removing the removeListener stuff but keeping the other part sounds like a good middleway to me 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@nodejs/streams @mafintosh PTAL |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@nodejs/tsc what do you think? An alternative approach might be to remove 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.
A nit: missing period.
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.
did you mean to add these logs?
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, they follow the prevailing pattern in this test file. Without the console.log statements, this is undebuggable.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Lots of good tests! LGTM from me 👍 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
03e66ed to
44fad80
Compare
|
CI: https://ci.nodejs.org/job/node-test-pull-request/13685/ |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Tagging @nodejs/tsc because it is semver-major. |
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.
Nit: not sure why this was changed and it doesn't really matter but for consistency I would keep the arrow function.
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.
@lpinca it is using this.read() below
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.
Oops, ignore me.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
44fad80 to
8085e2e
Compare
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 avoid the line break and capitalize the sentence?
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.
ditto
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.
Might be good to have chunk printed out here as well
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 change to comment above this line so that it says why we do this, rather than what we do? I assume it’s about the this.resume() call below?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
In Streams3 the 'readable' event/.read() method had a lower precedence than the `'data'` event that made them impossible to use them together. This make `.resume()` a no-op if there is a listener for the `'readable'` event, making the stream non-flowing if there is a `'data'` listener. Fixes: nodejs#18058
8085e2e to
578a7b9
Compare
|
@addaleax PTAL |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed as cf5f986 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
In Streams3 the 'readable' event/.read() method had a lower precedence than the `'data'` event that made them impossible to use them together. This make `.resume()` a no-op if there is a listener for the `'readable'` event, making the stream non-flowing if there is a `'data'` listener. Fixes: #18058 PR-URL: #18994 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
|
Seems like failures in cf5f986#diff-573b8412079b987e160a3fde511d5b9b are showing up in a couple places In a couple CI runs in #19201 and also in http://github.com/nodejs/node/pull/19924 @mcollina thoughts? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@MylesBorins We are already tracking it in #19905. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Caused by nodejs/node#18994 Closes #26
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.