Uh oh!
There was an error while loading. Please reload this page.
[x] stream: eof & pipeline compat - #29724
Conversation
ronag
commented
Sep 26, 2019
ping @mafintosh |
617e410 to
ec1fb21Compareb1deba7 to
53e0fe6CompareUh oh!
There was an error while loading. Please reload this page.
92d3138 to
b2f52b5Comparebbba57c to
9e9b654CompareUh oh!
There was an error while loading. Please reload this page.
ronag
commented
Dec 31, 2019
Is this still relevant? Been stale for a while... Happy new year! |
ronag
commented
Jan 1, 2020
rebased to fix conflicts |
nodejs-github-bot
commented
Jan 1, 2020
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
Jan 1, 2020
CI |
nodejs-github-bot
commented
Jan 1, 2020
ronag
commented
Jan 9, 2020
ping @mafintosh |
Make stream.finished callback invoked if stream is already closed/destroyed.
PR-URL: nodejs#29664 Reviewed-By: Minwoo Jung <minwoo@nodesource.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Some broken streams might emit 'close' before 'end' or 'finish'. However, if they have actually been ended or finished, this should not result in a premature close error. Fixes: nodejs#29699
ronag
commented
Jan 18, 2020
rebased to fix conflict |
ronag
commented
Jan 18, 2020
Turns out this actually had a little bit of an issue, the stream might still be in a pending state after |
a858773 to
bfca3d1Comparemafintosh
commented
Jan 21, 2020
This is still quite complex, but tried to do another pass at it. Can give an slight 👍. As mentioned in my comment I think it's worth investing in making a happy-path for when a stream is autoDestroy: true since that's much easier to reason about. |
Thx!
I'm not quite sure I understand what you mean by this? Something like the following? if(autoDestroy&&emitClose){if(opts.error!==false)stream.on('error',onerror);functiononclose(){callback.call(stream);}if(closed){process.nextTick(callback.bind(stream));}else{stream.on('close',onclose);}return()=>{stream.removeListener('close',onclose);stream.removeListener('error',onerror);};}// Rest is compat and edge cases... |
My general feeling is that landing this safely is uncertain due to the complexity of the changes and uncertainty of reviewers. There are actually several changes here that do not need to be directly related and could be split up. I'm closing this in favour of smaller on more specific PR's. Please let me know if there are any objections to this. |
Some broken streams might emit 'close' before 'end' or 'finish'. However, if they have actually been ended or finished, this should not result in a premature close error.
This fixes#29699 while still maintaining what could be considered correct behaviour.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes