FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

lib: setup IPC channel before console by seishun · Pull Request #16562 · nodejs/node · GitHub

/ node Public

lib: setup IPC channel before console - #16562

Closed
seishun wants to merge 0 commit into
nodejs:masterfrom
seishun:ipc-einval
Closed

lib: setup IPC channel before console#16562
seishun wants to merge 0 commit into
nodejs:masterfrom
seishun:ipc-einval

Conversation

seishun commented Oct 27, 2017
edited by refack
Loading

Copy link
Copy Markdown
Contributor

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), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

lib

nodejs-github-bot added the lib / src Issues and PRs related to general changes in the lib or src directory. label Oct 27, 2017

addaleax left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

If there is no way to write a test for this, can you add a comment so that nobody accidentally moves this around again?

refack commented Oct 27, 2017

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM but a test would be great.

seishun commented Oct 28, 2017

Copy link
Copy Markdown
Contributor Author

Added a test. @cjihrig @addaleax @refack PTAL

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Suggestion:

// make sure `fd[1]` has not been opened for `console`

Comment thread lib/internal/bootstrap_node.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Suggestion:

// This needs to happen after `_process.setupChannel()`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

There's a regression test and git blame, so I don't think it's necessary (or even useful in this form tbh).

bnoordhuis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM FWIW

seishun commented Oct 29, 2017

Copy link
Copy Markdown
Contributor Author

cjihrig commented Oct 29, 2017

Copy link
Copy Markdown
Contributor

Still LGTM, thanks.

seishun commented Oct 29, 2017

Copy link
Copy Markdown
Contributor Author

The failure seems unrelated.

seishun added a commit that referenced this pull request Oct 29, 2017
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>
seishun closed this Oct 29, 2017

seishun commented Oct 29, 2017

Copy link
Copy Markdown
Contributor Author

Landed in 403ccb6.

seishun deleted the ipc-einval branch October 29, 2017 19:29
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
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>
gibfahn pushed a commit that referenced this pull request Oct 30, 2017
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>
gibfahn pushed a commit that referenced this pull request Oct 31, 2017
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>
gibfahn mentioned this pull request Oct 31, 2017
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
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>
Qard pushed a commit to ayojs/ayo that referenced this pull request Nov 2, 2017
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>

Copy link
Copy Markdown
Contributor

Should this be backported to v6.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label.

seishun commented Nov 16, 2017

Copy link
Copy Markdown
Contributor Author

No need to backport since #16141 isn't an issue on v6.x AFAIK.

addaleax pushed a commit to ayojs/ayo that referenced this pull request Dec 7, 2017
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error "write EINVAL"

8 participants


Back | FazBrowse Home | New Git URL