-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
stream: don't emit end after close #33076
Conversation
841f7af
to
879ab7c
Compare
879ab7c
to
b36eed4
Compare
@@ -113,7 +113,7 @@ const assert = require('assert'); | |||
read.destroy(); | |||
|
|||
read.removeListener('end', fail); | |||
read.on('end', common.mustCall()); | |||
read.on('end', common.mustNotCall()); |
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.
NOTE, possible breaking change
@@ -124,7 +124,7 @@ const assert = require('assert'); | |||
|
|||
duplex.removeListener('end', fail); | |||
duplex.removeListener('finish', fail); | |||
duplex.on('end', common.mustCall()); | |||
duplex.on('end', common.mustNotCall()); |
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.
NOTE, possible breaking change
Please note that this can have breaking consequences. Though this PR ensures "proper" behaviour the ecosystem might make incorrect assumptions that this PR breaks. Would appreciate some feedback and thoughts on the risks. @nodejs/streams @mafintosh |
f7b791b
to
4ee7287
Compare
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.
I have a feeling this would be too breaking.
I suspected soo. Anyway, we are aware of this issue and maybe we can revisit this at a later point. We've got quite a lot of recent semver-major stuff so it might be a good idea to wait regardless. Should I document this "known issue" somewhere somehow? |
Documenting it's a good idea. |
On the other hand, the documentation has stated for 5 years now (db4cb33) that the close event "indicates that no more events will be emitted". |
I would say let’s fix this. It would be good if we had an opt-out flag. |
I'm a little unsure about the value of this. If a library breaks because of this (which is still unlikely, but possible) it should not be much more difficult to actually fix the issue rather than having to add a flag? Would it be an alternative to begin with no adding a flag, and then add it if this turns out to be a problem? |
hey @nodejs/tsc, do you think a commit that fixes that is semver-major? It's potentially breaking (see code), however it might be worthwhile landing in v14. |
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.
lgtm
Hmmm hard to say really. This change looks good to me, however. |
Readable stream could emendd' after 'close'.
rebased to fix conflict |
4ee7287
to
412129c
Compare
CI: https://ci.nodejs.org/job/node-test-pull-request/31013/ (:heavy_check_mark:) |
After speaking with @mafintosh, let's go with a minor and see. I would not backport it to v12. |
Readable stream could emit 'end' after 'close'. PR-URL: #33076 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Landed in f64c640 |
Readable stream could emit 'end' after 'close'. PR-URL: #33076 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Notable changes: - deps: upgrade openssl sources to 1.1.1g (Hassaan Pasha) [#32971](#32971) - doc: add juanarbol as collaborator (Juan José Arboleda) [#32906](#32906) - http: doc deprecate abort and improve docs (Robert Nagy) [#32807](#32807) - module: do not warn when accessing `__esModule` of unfinished exports (Anna Henningsen) [#33048](#33048) - n-api: detect deadlocks in thread-safe function (Gabriel Schulhof) [#32860](#32860) - src: deprecate embedder APIs with replacements (Anna Henningsen) [#32858](#32858) - stream: - don't emit end after close (Robert Nagy) [#33076](#33076) - don't wait for close on legacy streams (Robert Nagy) [#33058](#33058) - pipeline should only destroy un-finished streams (Robert Nagy) [#32968](#32968) PR-URL: #33103
Readable stream could emit 'end' after 'close'. PR-URL: #33076 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Notable changes: - deps: upgrade openssl sources to 1.1.1g (Hassaan Pasha) [#32971](#32971) - doc: add juanarbol as collaborator (Juan José Arboleda) [#32906](#32906) - http: doc deprecate abort and improve docs (Robert Nagy) [#32807](#32807) - module: do not warn when accessing `__esModule` of unfinished exports (Anna Henningsen) [#33048](#33048) - n-api: detect deadlocks in thread-safe function (Gabriel Schulhof) [#32860](#32860) - src: deprecate embedder APIs with replacements (Anna Henningsen) [#32858](#32858) - stream: - don't emit end after close (Robert Nagy) [#33076](#33076) - don't wait for close on legacy streams (Robert Nagy) [#33058](#33058) - pipeline should only destroy un-finished streams (Robert Nagy) [#32968](#32968) - vm: add importModuleDynamically option to compileFunction (Gus Caplan) [#32985](#32985) PR-URL: #33103
Notable changes: - deps: upgrade openssl sources to 1.1.1g (Hassaan Pasha) [#32971](#32971) - doc: add juanarbol as collaborator (Juan José Arboleda) [#32906](#32906) - http: doc deprecate abort and improve docs (Robert Nagy) [#32807](#32807) - module: do not warn when accessing `__esModule` of unfinished exports (Anna Henningsen) [#33048](#33048) - n-api: detect deadlocks in thread-safe function (Gabriel Schulhof) [#32860](#32860) - src: deprecate embedder APIs with replacements (Anna Henningsen) [#32858](#32858) - stream: - don't emit end after close (Robert Nagy) [#33076](#33076) - don't wait for close on legacy streams (Robert Nagy) [#33058](#33058) - pipeline should only destroy un-finished streams (Robert Nagy) [#32968](#32968) - vm: add importModuleDynamically option to compileFunction (Gus Caplan) [#32985](#32985) PR-URL: #33103
Notable changes: - deps: upgrade openssl sources to 1.1.1g (Hassaan Pasha) [#32971](#32971) - doc: add juanarbol as collaborator (Juan José Arboleda) [#32906](#32906) - http: doc deprecate abort and improve docs (Robert Nagy) [#32807](#32807) - module: do not warn when accessing `__esModule` of unfinished exports (Anna Henningsen) [#33048](#33048) - n-api: detect deadlocks in thread-safe function (Gabriel Schulhof) [#32860](#32860) - src: deprecate embedder APIs with replacements (Anna Henningsen) [#32858](#32858) - stream: - don't emit end after close (Robert Nagy) [#33076](#33076) - don't wait for close on legacy streams (Robert Nagy) [#33058](#33058) - pipeline should only destroy un-finished streams (Robert Nagy) [#32968](#32968) - vm: add importModuleDynamically option to compileFunction (Gus Caplan) [#32985](#32985) PR-URL: #33103
Readable stream could emit 'end' after 'close'.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes