| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
CI: https://ci.nodejs.org/job/node-test-pull-request/13369/ |
Sorry, something went wrong.
|
Wouldn't removeAllListeners() to be handled as well, since there could be no 'removeListener' event handlers? |
Sorry, something went wrong.
|
@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 'removeListener' instead? I thought this approach could theoretically be more performing, but it's an edge case anyway. |
Sorry, something went wrong.
|
@mcollina so basically just suspends flowing when readable is set? |
Sorry, something went wrong.
|
@mafintosh that's the goal yes. It also restores the behavior after 'readable' is removed. |
Sorry, something went wrong.
|
@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.
|
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.
|
Removing the removeListener stuff but keeping the other part sounds like a good middleway to me 👍 |
Sorry, something went wrong.
Sorry, something went wrong.
|
@nodejs/tsc what do you think? An alternative approach might be to remove the readableListening variable and just use listenerCount, hopefully it would be fast enough. |
Sorry, something went wrong.
There was a problem hiding this comment.
A nit: missing period.
Sorry, something went wrong.
There was a problem hiding this comment.
did you mean to add these logs?
Sorry, something went wrong.
There was a problem hiding this comment.
Yes, they follow the prevailing pattern in this test file. Without the console.log statements, this is undebuggable.
Sorry, something went wrong.
|
Lots of good tests! LGTM from me 👍 |
Sorry, something went wrong.
|
CI: https://ci.nodejs.org/job/node-test-pull-request/13685/ |
Sorry, something went wrong.
|
Tagging @nodejs/tsc because it is semver-major. |
Sorry, something went wrong.
There was a problem hiding this comment.
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 a problem hiding this comment.
@lpinca it is using this.read() below
Sorry, something went wrong.
There was a problem hiding this comment.
Oops, ignore me.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
Can you avoid the line break and capitalize the sentence?
Sorry, something went wrong.
There was a problem hiding this comment.
ditto
Sorry, something went wrong.
There was a problem hiding this comment.
Might be good to have chunk printed out here as well
Sorry, something went wrong.
There was a problem hiding this comment.
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.
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
Sorry, something went wrong.
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 <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
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? not ok 750 parallel/test-http-readable-data-event
---
duration_ms: 0.725
severity: fail
stack: |-
assert.js:79
throw new AssertionError(obj);
^
AssertionError [ERR_ASSERTION]: 'Hello World!Hello again later!' strictEqual 'Hello World!'
at IncomingMessage.res.on.common.mustCall (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/test/parallel/test-http-readable-data-event.js:43:14)
at IncomingMessage.<anonymous> (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/test/common/index.js:467:15)
at IncomingMessage.emit (events.js:182:13)
at IncomingMessage.Readable.read (_stream_readable.js:489:10)
at IncomingMessage.res.on.common.mustCall (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/test/parallel/test-http-readable-data-event.js:36:20)
at IncomingMessage.<anonymous> (/home/iojs/build/workspace/node-test-commit-plinux/nodes/ppcle-ubuntu1404/test/common/index.js:467:15)
at IncomingMessage.emit (events.js:182:13)
at emitReadable_ (_stream_readable.js:537:12)
at process._tickCallback (internal/process/next_tick.js:174:19)
...
|
Sorry, something went wrong.
|
@MylesBorins We are already tracking it in #19905. |
Sorry, something went wrong.
Caused by nodejs/node#18994 Closes #26
| Back | FazBrowse Home | New Git URL |
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
Checklist
Affected core subsystem(s)
stream, http