Uh oh!
There was an error while loading. Please reload this page.
stream: eos on closed - #28748
Conversation
3c57be4 to
c9d1e19CompareTrott
commented
Jul 23, 2019
/ping @nodejs/streams |
nodejs-github-bot
commented
Jul 23, 2019
mcollina
left a comment
There was a problem hiding this comment.
Would you mind to add the equivalent test for Readable as well?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ronag
commented
Jul 23, 2019
@mcollina updated |
aefe068 to
1588c78CompareUh oh!
There was an error while loading. Please reload this page.
40b4c0b to
39ca23aCompareronag
commented
Aug 2, 2019
@benjamingr ping |
mcollina
commented
Aug 3, 2019
@nodejs/tsc this needs another review. |
ronag
commented
Aug 6, 2019
@mcollina: Should this maybe result in a |
ronag
commented
Sep 1, 2019
@mcollina: done |
ronag
commented
Sep 1, 2019
@Trott: Updated PR description to describe the included changes from the other PR (which is now closed). |
ronag
commented
Sep 1, 2019
This needs another CITGM (once Travis is ok) given the recent changes. |
There was a problem hiding this comment.
There is an added test for this change. We should always be emitting premature close unless we've seen finish or end events. I don't think this actually changes anything in practice.
nodejs-github-bot
commented
Sep 1, 2019
nodejs-github-bot
commented
Sep 1, 2019
mcollina
commented
Sep 2, 2019
This will need a rebase, otherwise it looks good to land. |
db6eb4f to
9b5a84eCompareronag
commented
Sep 2, 2019
rebased |
nodejs-github-bot
commented
Sep 2, 2019
mcollina
commented
Sep 3, 2019
Landed in b03845b |
Make stream.finished callback invoked if stream is already closed/destroyed. PR-URL: #28748 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
mafintosh
commented
Sep 23, 2019
A little late to the party here, but this includes a big change in behaviour for streams. Since the finished flag is used instead of the ended flag, this PR changes the behaiviour of eos to the following: conststream=require('stream')constws=newstream.Writable({write(data,enc,cb){process.nextTick(cb,null)}})finished(ws,function(err){console.log('This used to *not* error:',err)})ws.write('data')ws.end()ws.emit('close')// modules tend to emit close on resource close but in a non error stateI was just bitten by this in a debugging session, so unsure if that was an intentional change? Streams are hard. |
stream.finishedshould be invoked if stream is already closed/destroyed. Currently there is a potential deadlock depending on whenstream.finishedis called.For writable premature close is close before finish, i.e. it should look for
finishedinstead ofended.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes