stream: ensure finish is emitted in next tick#30733
Closed
ronag wants to merge 1 commit intonodejs:masterfrom
Closed
stream: ensure finish is emitted in next tick#30733ronag wants to merge 1 commit intonodejs:masterfrom
ronag wants to merge 1 commit intonodejs:masterfrom
Conversation
Member
Author
|
@Trott: Who's familiar with |
e197831 to
a9e54cc
Compare
4 tasks
Member
a9e54cc to
7ee659f
Compare
When using end() it was possible for 'finish' to be emitted synchronously.
7ee659f to
cdc12a6
Compare
Collaborator
Member
4 tasks
Member
Author
|
@benjamingr can I get a nodejs/streams ping on this one? |
Member
Author
|
|
Member
|
@nodejs/streams also this is terrifying :D |
addaleax
approved these changes
Dec 7, 2019
Member
|
This needs another @nodejs/tsc approval (@mcollina?) but should otherwise be good to go |
Member
Author
|
@Trott: |
Member
|
CITGM looks good. |
Trott
approved these changes
Dec 14, 2019
Trott
pushed a commit
that referenced
this pull request
Dec 14, 2019
When using end() it was possible for 'finish' to be emitted synchronously. PR-URL: #30733 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
Member
|
Landed in e13a37e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using
end()it was possible for'finish'to be emitted synchronously causing incorrect behaviour and subtle bugs.This is an edge case not usually encountered since a
write()is usually pending and will be the one to initiatefinishMaybe()throughafterWritewhich is always async.This PR also cause
_destroy()to be called in nextTick whenautoDestroyis enabled during this edge case.NOTE:
'prefinish'must be synchronous in order to not breakTransform. I've got another PR in the works to sort this out.Should probably be semver major.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes