-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
clusterIssues and PRs related to the cluster subsystem.Issues and PRs related to the cluster subsystem.netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.
Description
- Version: v8.6.0
- Subsystem: net, cluster
When calling server.listen('./socket.sock')
in a worker, the relative path is passed as-is to the master,
causing the path to be relative to the master's CWD, instead of the child process' CWD.
This behavior is inconsistent with listen(...)
outside of a worker.
Here's a short example illustrating the issue:
const cluster = require('cluster');
const http = require('http');
if (cluster.isMaster) {
cluster.fork();
} else {
const server = http.createServer();
process.chdir('/tmp');
server.listen("./test.sock");
}
Expected outcome: test.sock
is created in /tmp
.
Actual outcome: test.sock
is created in the previous directory.
Solution:
UNIX domain socket paths should immediately be resolved to absolute paths using path.resolve(...)
before anything else is done with them (such as passing them to the master process).
Metadata
Metadata
Assignees
Labels
clusterIssues and PRs related to the cluster subsystem.Issues and PRs related to the cluster subsystem.netIssues and PRs related to the net subsystem.Issues and PRs related to the net subsystem.