-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cluster: correctly handle relative unix socket paths #16749
Conversation
I feel like this should be done more upstream (in node core) to avoid having to potentially call |
lib/internal/cluster/child.js
Outdated
@@ -58,11 +65,13 @@ cluster._getServer = function(obj, options, cb) { | |||
else | |||
indexes[indexesKey]++; | |||
|
|||
const message = util._extend({ | |||
const message = Object.assign({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK we are still using util._extend()
instead Object.assign()
for performance reasons.
@@ -0,0 +1,45 @@ | |||
// Copyright Joyent, Inc. and other Node contributors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New tests don't need the copyright comment.
})); | ||
} else { | ||
process.chdir('./unix-socket-dir'); | ||
net.createServer(common.mustNotCall()).listen('./cluster.sock', function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a common.mustCall()
to the callback.
fs.existsSync('./cluster.sock'), true, | ||
'cluster.sock created in CWD'); | ||
|
||
process.exit(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of forcing the exit, can you cleanup as necessary and let the process exit naturally.
Do you like your PR commits --amend'ed or with a second commit? |
@laino Whatever is easier for you :) We’re going to squash commits when landing them anyway |
4f3e58f
to
9ce5f77
Compare
Hey, is there anything else that needs changing for this to be merged? |
@laino Related failures on all Windows builds:
|
@joyeecheung That's the test I added with this PR. It should probably be disabled on windows, but I'm not sure. I don't know much about named pipes on windows. |
I'll check tomorrow whether there's any tests for named pipes at all for windows, since I'm worried now this might break something. Also I should probably change https://github.com/nodejs/node/pull/16749/files#diff-a8eff7604cf3ad3580c1949c54176127R282 to only happen on Linux, since it doesn't make much sense on systems that don't have the arbitrary 100 byte limitation. |
Hello @laino, Welcome, and thank you for the contribution! 🥇 Named pipes on Windows live in their own FS namespace, and must be prefixed with if (common.isWindows)
common.skip('no 100 byte limit on pipe names on Windows'); |
ping @laino ... If you have the opportunity, could you try to fix this on Windows, or if not, could you let us know? |
Ping @laino |
Relative unix sockets paths were previously interpreted relative to the master's CWD, which was inconsistent with non-cluster behavior. A test case has been added as well. Fixes: nodejs#16387
9ce5f77
to
e9d6c4b
Compare
Sorry, I had all but forgotten about this PR. I made sure the test won't run on windows and that the code to deal with unix domain sockets |
https://ci.nodejs.org/job/node-test-commit-arm/13003/nodes=ubuntu1604-arm64_odroid_c2/console This is the build that failed. Doesn't seem to be related to this? |
@laino That's a known OOM issue, the CI looks green to me. |
|
||
// Ref: | ||
// https://github.com/nodejs/node/issues/16387 | ||
// https://github.com/nodejs/node/pull/16749 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These refs can be removed during landing. They should be in the metadata, not in the comments.
CI before landing https://ci.nodejs.org/job/node-test-pull-request/12568/ |
Landed in 4e2e7d1, thanks! |
Relative unix sockets paths were previously interpreted relative to the master's CWD, which was inconsistent with non-cluster behavior. A test case has been added as well. PR-URL: #16749 Fixes: #16387 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Back-porters: should be back-ported along with #18263. |
Relative unix sockets paths were previously interpreted relative to the master's CWD, which was inconsistent with non-cluster behavior. A test case has been added as well. PR-URL: #16749 Fixes: #16387 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Should this be backported to |
Relative unix sockets paths were previously interpreted relative to the master's CWD, which was inconsistent with non-cluster behavior. A test case has been added as well. PR-URL: #16749 Fixes: #16387 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Relative unix sockets paths were previously interpreted relative to the master's CWD, which was inconsistent with non-cluster behavior. A test case has been added as well.
I only added the "find the shortest possible path for unix sockets" to the cluster code, so that
outside of workers the net API would still map to the actual syscalls happening under the hood
cleanly.
Fixes: #16387
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
net, cluster