Uh oh!
There was an error while loading. Please reload this page.
stream: improving error handling - #18438
Conversation
mafintosh
commented
Jan 29, 2018
/cc @mcollina @nodejs/streams |
There was a problem hiding this comment.
Nits:
An stream -> A stream
was been -> has been
There was a problem hiding this comment.
A nit: should not emitted -> should not be emitted
There was a problem hiding this comment.
A nit: should not emitted -> should not be emitted
jasnell
commented
Jan 29, 2018
@nodejs/http2 ... just a quick note that this will have a relatively small impact on the |
mafintosh
commented
Jan 30, 2018
Added docs about the |
There was a problem hiding this comment.
I'm not very fond of this lines. A current goal is to reduce (or totally remove) the number of access to _readableState and _writableState. However, this requires it. Maybe emitting 'close' automatically can be moved to an option?
There was a problem hiding this comment.
This is only because http2 currently emits a 'code' argument with the close event. The idea is to get rid of that in http2 and move the 'code' to a property down the line, but this ensures backwards compat right now.
Should I add a comment explaining that?
There was a problem hiding this comment.
What I mean is that in both fs and http2 for compat reason we need to not emit 'close' on destroy. I think this might actually be a legit use case, and so we should support it with an option at construction.
There was a problem hiding this comment.
The fs thing is legit, but we should just get rid of the code in http2 imo, but that's another discussion. I like the idea of an option, adding it.
There was a problem hiding this comment.
I think this check can me moved in the previous if block: state.ended || state.reading || state.destroyed.
There was a problem hiding this comment.
can you add one more test for the _flush() logic and destroy()? It seems you are fixing a bug here. Or without this change some tests would not pass anymore?
4bc9c16 to
958d5beComparemafintosh
commented
Jan 30, 2018
@mcollina fixed your comments |
mafintosh
commented
Jan 30, 2018
@mcollina nit fixed |
mcollina
commented
Jan 31, 2018
@mafintosh can you add |
mafintosh
commented
Jan 31, 2018
@mcollina fixed the docs |
There was a problem hiding this comment.
Seems like cause should be because here, I think?
mafintosh
commented
Jan 31, 2018
mcollina
commented
Feb 1, 2018
mafintosh
commented
Feb 2, 2018
@mcollina ci seemed to have an issue? |
mcollina
commented
Feb 2, 2018
We are testing in so many system that a botched run happens every now and then. |
6e65b5e to
1689bafCompareLanded as 5e3f516 |
This improves error handling for streams in a few ways. 1. It ensures that no user defined methods (_read, _write, ...) are run after .destroy has been called. 2. It introduces an explicit error to tell the user if they are write to write, etc to the stream after it has been destroyed. 3. It makes streams always emit close as the last thing after they have been destroyed 4. Changes the default _destroy to not gracefully end streams. It also updates net, http2, zlib and fs to the new error handling. PR-URL: #18438 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
joyeecheung
commented
Mar 6, 2018
This is breaking the linter on master |
This improves error handling for streams in a few ways. 1. It ensures that no user defined methods (_read, _write, ...) are run after .destroy has been called. 2. It introduces an explicit error to tell the user if they are write to write, etc to the stream after it has been destroyed. 3. It makes streams always emit close as the last thing after they have been destroyed 4. Changes the default _destroy to not gracefully end streams. It also updates net, http2, zlib and fs to the new error handling. PR-URL: nodejs#18438 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net>
See: nodejs#18438 PR-URL: nodejs#19169 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
See: nodejs#25373 See: nodejs#18438 PR-URL: nodejs#25413 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
stream
This PR improves error handling for streams in a few ways.
closeas the last thing after they have been destroyedEspecially 4. makes it easier for userland modules to handle stream errors as they don't appear as graceful closes anymore. Seen issues being with end-of-stream/pump because of this.