Conversation
3c57be4 to
c9d1e19
Compare
|
/ping @nodejs/streams |
mcollina
left a comment
There was a problem hiding this comment.
Would you mind to add the equivalent test for Readable as well?
c9d1e19 to
3816f11
Compare
|
@mcollina updated |
aefe068 to
1588c78
Compare
40b4c0b to
39ca23a
Compare
|
@benjamingr ping |
|
@nodejs/tsc this needs another review. |
|
@mcollina: Should this maybe result in a |
@mcollina: done |
|
@Trott: Updated PR description to describe the included changes from the other PR (which is now closed). |
|
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.
|
This will need a rebase, otherwise it looks good to land. |
db6eb4f to
9b5a84e
Compare
|
rebased |
|
Landed in b03845b |
Make stream.finished callback invoked if stream is already closed/destroyed. PR-URL: #28748 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
|
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: const stream = require('stream')
const ws = new stream.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