Uh oh!
There was an error while loading. Please reload this page.
stdio: make stdout and stderr emit 'close' on destroy - #26691
Conversation
mcollina
commented
Mar 15, 2019
| if (!this._writableState.emitClose) { | ||
| process.nextTick(() => { | ||
| this.emit('close'); | ||
| }); |
There was a problem hiding this comment.
How come the nextTick is required in this case?
There was a problem hiding this comment.
The previous cb() could emitting an error via nextTick. Close should be emitted afterwards.
There was a problem hiding this comment.
Are you ok/can this PR land, or would you like to see some different resolution for this?
mcollina
commented
Mar 16, 2019
| // SyncWriteStream does not use the stream | ||
| // destroy mechanism for some legacy reason. | ||
| // TODO(mcollina): remove when | ||
| // https://github.com/nodejs/node/pull/26690 lands. |
There was a problem hiding this comment.
What exactly are you intending to remove? The dummyDestroy() function? It’s intentional that stdio streams, SyncWriteStream or not, cannot “really” be closed (so that file descriptors 0, 1, 2 don’t accidentally get closed).
There was a problem hiding this comment.
The if check underneath. See the linked PR. Basically we can have a callback or not for this function.
There was a problem hiding this comment.
We can! However that was a semver-major commit and this is not. I would prefer to issue a follow-up PR that will not be backported. This can (and should) be backported.
mcollina
commented
Mar 17, 2019
@nodejs/build can you take a look at https://ci.nodejs.org/job/node-test-commit-linux/26139/nodes=ubuntu1604-64/console? there seems a problem with that machine, if failed a couple of times. |
mcollina
commented
Mar 17, 2019
rvagg
commented
Mar 17, 2019
I've updated, cleaned and rebooted that ubuntu machine, will see if that helps |
A root-owned directory was left around after some troubleshooting (generating a core file for another issue), and Resume Build CI: https://ci.nodejs.org/job/node-test-pull-request/21615/ ✅ |
mcollina
commented
Mar 20, 2019
I will look to land this next Monday if there are no further objections. I'd also open a new PR to remove that if check at the same time. |
mcollina
commented
Mar 25, 2019
Landed in bdea725 |
Fix: #26550 PR-URL: #26691 Fixes: https://github.com/falseFixes: #26550 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
nodejs#26691 introduced an if to protect against SyncWriteStream not using the default .destroy() mechanism. This change removes that as SyncWriteStream now use standard .destroy(). See: nodejs#26691
lpinca
commented
Mar 25, 2019
Commit landed with messed up metadata, I guess it's too late to fix it. |
mcollina
commented
Mar 25, 2019
Ouch, I didn't notice. I relied too blindly on git node land. |
joyeecheung
commented
Mar 25, 2019
We should probably add some stricter checks in https://github.com/nodejs/core-validate-commit for these cases |
Fix: nodejs#26550 PR-URL: nodejs#26691 Fixes: https://github.com/falseFixes: nodejs#26550 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Fix: #26550 PR-URL: #26691 Fixes: https://github.com/falseFixes: #26550 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
#26691 introduced an if to protect against SyncWriteStream not using the default .destroy() mechanism. This change removes that as SyncWriteStream now use standard .destroy(). See: #26691 PR-URL: #26902 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
richardlau
commented
Mar 31, 2019
|
#26691 introduced an if to protect against SyncWriteStream not using the default .destroy() mechanism. This change removes that as SyncWriteStream now use standard .destroy(). See: #26691 PR-URL: #26902 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
BethGriggs
commented
Jul 9, 2019
@mcollina should this still land on v10.x? |
mcollina
commented
Jul 9, 2019
Yes please |
Fix: #26550 PR-URL: #26691 Fixes: https://github.com/falseFixes: #26550 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Fix: #26550 PR-URL: #26691 Fixes: https://github.com/falseFixes: #26550 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
The problem in #26550 was caused by
net.Sockethaving setemitClose: falsebecause it was emitted its own event in_destroy(), andstdio.jswas overriding_destroywithout emitting'close'.Fix: #26550
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes