lib: setup IPC channel before console#16562
lib: setup IPC channel before console#16562seishun wants to merge 0 commit intonodejs:masterfrom seishun:ipc-einval
Conversation
addaleax
left a comment
There was a problem hiding this comment.
If there is no way to write a test for this, can you add a comment so that nobody accidentally moves this around again?
|
AFAICT a regression test is simple: d:\code\node-master$ set NODE_CHANNEL_FD=0
d:\code\node-master$ node
child_process.js:107
p.open(fd);
^
Error: EINVAL: invalid argument, uv_pipe_open
at Object.exports._forkChild (child_process.js:107:5)
at Object.setupChannel (internal/process.js:244:8)
at startup (bootstrap_node.js:69:16)
at bootstrap_node.js:608:3
d:\code\node-master$ set NODE_CHANNEL_FD=
d:\code\node-master$ |
cjihrig
left a comment
There was a problem hiding this comment.
LGTM but a test would be great.
There was a problem hiding this comment.
Suggestion:
// make sure `fd[1]` has not been opened for `console`
lib/internal/bootstrap_node.js
Outdated
There was a problem hiding this comment.
Suggestion:
// This needs to happen after `_process.setupChannel()`There was a problem hiding this comment.
There's a regression test and git blame, so I don't think it's necessary (or even useful in this form tbh).
|
Still LGTM, thanks. |
|
The failure seems unrelated. |
Initializing IOCP on the same fd twice can fail on Windows. Consequently, if the IPC channel uses fd 1 or 2 and the console is setup first, writing to the IPC channel will fail. PR-URL: #16562 Fixes: #16141 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Landed in 403ccb6. |
Initializing IOCP on the same fd twice can fail on Windows. Consequently, if the IPC channel uses fd 1 or 2 and the console is setup first, writing to the IPC channel will fail. PR-URL: #16562 Fixes: #16141 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Initializing IOCP on the same fd twice can fail on Windows. Consequently, if the IPC channel uses fd 1 or 2 and the console is setup first, writing to the IPC channel will fail. PR-URL: #16562 Fixes: #16141 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Initializing IOCP on the same fd twice can fail on Windows. Consequently, if the IPC channel uses fd 1 or 2 and the console is setup first, writing to the IPC channel will fail. PR-URL: #16562 Fixes: #16141 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Initializing IOCP on the same fd twice can fail on Windows. Consequently, if the IPC channel uses fd 1 or 2 and the console is setup first, writing to the IPC channel will fail. PR-URL: nodejs/node#16562 Fixes: nodejs/node#16141 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Initializing IOCP on the same fd twice can fail on Windows. Consequently, if the IPC channel uses fd 1 or 2 and the console is setup first, writing to the IPC channel will fail. PR-URL: nodejs/node#16562 Fixes: nodejs/node#16141 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Should this be backported to |
|
No need to backport since #16141 isn't an issue on v6.x AFAIK. |
Initializing IOCP on the same fd twice can fail on Windows. Consequently, if the IPC channel uses fd 1 or 2 and the console is setup first, writing to the IPC channel will fail. PR-URL: nodejs/node#16562 Fixes: nodejs/node#16141 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
Initializing IOCP on the same fd twice can fail on Windows.
Consequently, if the IPC channel uses fd 1 or 2 and the console is setup
first, writing to the IPC channel will fail.
Fixes: #16141
Will add a test if there are no objections to this approach.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
lib