Uh oh!
There was an error while loading. Please reload this page.
src: restore stdio on program exit - #20592
Conversation
gireeshpunathil
commented
May 8, 2018
gireeshpunathil
commented
May 8, 2018
looks really promising, let us see how the CI responds. |
gireeshpunathil
commented
May 8, 2018
2 failures, one on freebsd: and one on arm: Does anyone know if this could be related to the PR? |
Trott
commented
May 8, 2018
Is it possible/worthwhile to write at least a minimal test for this behavior? |
Trott
commented
May 8, 2018
@gireeshpunathil The first error has been seen in CI before: #18658 The second one is new to me. Let's see what happens if we re-run CI: |
gireeshpunathil
commented
May 9, 2018
thanks @Trott - those 2 failures are vanished and new ones appear, so safe to assume these are unrelated flaky stuff. @tabkrz - #18446 and #14752 have minimal test cases to reproduce the issue, please see if you can develop them into fully-blown tests. A rough sketch would be:
Please refer to test/parallel/test-child-process-spawn* test cases for general structure, spawn logic, validation logic etc. |
ktaborski
commented
May 9, 2018
I will check. |
addaleax
left a comment
There was a problem hiding this comment.
Does anyone know if this could be related to the PR?
My intuition would be “no”, but we should probably not land this PR without a fully green CI.
Next attempt: https://ci.nodejs.org/job/node-test-commit/18334/
gireeshpunathil
commented
May 10, 2018
interesting to see every time we run a new CI, the failure count increases, linearly! btw what is |
Trott
commented
May 11, 2018
Just took some problematic CI nodes offline. Let's try again... |
gireeshpunathil
commented
May 11, 2018
barring the unknown 13:54:49make[1]: *** [Makefile:87: node] Terminated13:54:49make: *** [Makefile:465: build-ci] Terminated13:54:49FATAL: commandexecutionfailed13:54:49java.nio.channels.ClosedChannelException13:54:49atorg.jenkinsci.remoting.protocol.NetworkLayer.onRecvClosed(NetworkLayer.java:154)
13:54:49atorg.jenkinsci.remoting.protocol.impl.NIONetworkLayer.ready(NIONetworkLayer.java:142)
13:54:49atorg.jenkinsci.remoting.protocol.IOHub$OnReady.run(IOHub.java:789)
13:54:49atjenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
13:54:49atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
13:54:49at |
bnoordhuis
commented
May 11, 2018
@tabkrz Can you keep my name on the code I wrote? I don't get too hung up on authorship if it's just a few lines but this is #17737 almost verbatim. |
ktaborski
commented
May 11, 2018
@bnoordhuis, please check if current form of PR is sufficient to you. |
bnoordhuis
left a comment
There was a problem hiding this comment.
@tabkrz Yes, it's fine now. Left some comments on the second commit.
There was a problem hiding this comment.
You could just if (isatty(fd)) continue; - saves a level of indent and makes the diff less noisy.
There was a problem hiding this comment.
I think, it should be if ( ! isatty(fd)) continue;
There was a problem hiding this comment.
That's what I mean, of course. :-)
There was a problem hiding this comment.
This can probably be simplified to just this now:
s.isatty= true;
do {
err=tcgetattr(fd, &s.termios);
} while (err==-1&&errno==EINTR);
CHECK_EQ(err, 0);gireeshpunathil
commented
May 13, 2018
We never got a clean CI, at the same time the failures were inconclusive. So running once again: |
gireeshpunathil
commented
May 15, 2018
all clean. |
BridgeAR
commented
May 18, 2018
@bnoordhuis @tabkrz would it be fine for you to land this as a single commit that is done by @bnoordhuis and @tabkrz as a co-author? |
ktaborski
commented
May 19, 2018
Fine for me. |
apapirovski
commented
May 22, 2018
@tabkrz Could you update the commits to correctly have your github email and name associated with them? If we land these as is then you won't get proper credit for the work. Thanks! (You can see our contributing guide for more info but basically it's this https://help.github.com/articles/setting-your-commit-email-address-in-git/) |
ktaborski
commented
May 22, 2018
@apapirovski, done. |
Record the state of the stdio file descriptors on start-up and restore them to that state on exit. This should prevent issues where node.js sometimes leaves stdio in raw or non-blocking mode. Fixes: #14752
termios-flags can be stored only in TTY environment
jasnell
commented
May 23, 2018
jasnell
commented
May 23, 2018
BridgeAR
commented
May 25, 2018
I am unsure how to land this one. Without squashing the first commit is going to result in errors. Suggestions? |
Node leaves stdio file descriptors in non-blocking mode when exiting. This has been reported, fixed, unfixed, ad nauseum. nodejs/node#14752nodejs/node#17737nodejs/node#20592nodejs/node#21257 Should this become a problem in more places, we could add such a workaround elsewhere. But for now I'm limiting the ugliness to the unit-tests container, where we see this cause a lot of failures. Closescockpit-project#9484
Node leaves stdio file descriptors in non-blocking mode when exiting. This has been reported, fixed, unfixed, ad nauseum. nodejs/node#14752nodejs/node#17737nodejs/node#20592nodejs/node#21257 Should this become a problem in more places, we could add such a workaround elsewhere. But for now I'm limiting the ugliness to the unit-tests container, where we see this cause a lot of failures. Closes#9484
Before PR 20592, closing all handles associated with the main event loop would also mean that `uv_tty_reset_mode()` can’t function properly because the corresponding FDs have already been closed. Add regression tests for this condition. Refs: #21020 Refs: #20592 PR-URL: #21027 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Node leaves stdio file descriptors in non-blocking mode when exiting. This has been reported, fixed, unfixed, ad nauseum. nodejs/node#14752nodejs/node#17737nodejs/node#20592nodejs/node#21257 Stolen from cockpit-project/cockpit@ef50d97cf4
Before PR 20592, closing all handles associated with the main event loop would also mean that `uv_tty_reset_mode()` can’t function properly because the corresponding FDs have already been closed. Add regression tests for this condition. Refs: #21020 Refs: #20592 PR-URL: #21027 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Record the state of the stdio file descriptors on start-up and restore them to that state on exit. This should prevent issues where node.js sometimes leaves stdio in raw or non-blocking mode. This is a reworked version of commit c2c9c0c from May 2018 that was reverted in commit 14dc17d from June 2018. The revert was a little light on details but I infer that the problem was caused by a missing call to `uv_tty_reset_mode()`. Apropos the NOLINT comments: cpplint doesn't understand do/while statements, it thinks they're while statements without a body. Fixes: nodejs#14752Fixes: nodejs#21020 Original-PR-URL: nodejs#20592
Record the state of the stdio file descriptors on start-up and restore them to that state on exit. This should prevent issues where node.js sometimes leaves stdio in raw or non-blocking mode. This is a reworked version of commit c2c9c0c from May 2018 that was reverted in commit 14dc17d from June 2018. The revert was a little light on details but I infer that the problem was caused by a missing call to `uv_tty_reset_mode()`. Apropos the NOLINT comments: cpplint doesn't understand do/while statements, it thinks they're while statements without a body. Fixes: nodejs#14752Fixes: nodejs#21020 Original-PR-URL: nodejs#20592 PR-URL: nodejs#24260 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Record the state of the stdio file descriptors on start-up and restore them to that state on exit. This should prevent issues where node.js sometimes leaves stdio in raw or non-blocking mode. This is a reworked version of commit c2c9c0c from May 2018 that was reverted in commit 14dc17d from June 2018. The revert was a little light on details but I infer that the problem was caused by a missing call to `uv_tty_reset_mode()`. Apropos the NOLINT comments: cpplint doesn't understand do/while statements, it thinks they're while statements without a body. Fixes: #14752Fixes: #21020 Original-PR-URL: #20592 PR-URL: #24260 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Refael Ackermann (רפאל פלחי) <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Record the state of the stdio file descriptors on start-up and restore
them to that state on exit. This should prevent issues where node.js
sometimes leaves stdio in raw or non-blocking mode.
Author of change: @bnoordhuis
Continuation of #17737 as original pull request was closed.
Fixes: #14752
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes