-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Closed
Copy link
Labels
clusterIssues and PRs related to the cluster subsystem.Issues and PRs related to the cluster subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.
Description
- Version: Node.js 7.2.1
- Platform: Windows 7 x64
- Subsystem: cluster, doc
In the preface of the cluster doc the first code example is followed by a shell illustration of a debug script call:
$ NODE_DEBUG=cluster node server.js
23521,Master Worker 23524 online
23521,Master Worker 23526 online
23521,Master Worker 23523 online
23521,Master Worker 23528 online
However, I can't get the same output in Windows:
J:\temp>type server.js
const cluster = require('cluster');
const http = require('http');
const numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
cluster.on('exit', (worker, code, signal) => {
console.log(`worker ${worker.process.pid} died`);
});
} else {
// Workers can share any TCP connection
// In this case it is an HTTP server
http.createServer((req, res) => {
res.writeHead(200);
res.end('hello world\n');
}).listen(8000);
}J:\temp>SET NODE_DEBUG=cluster && node server.js
// no debug output;
// process monitor shows all four clusters are running;
// servers respond successfully.
// press Ctrl+C
^C
J:\temp>
// environment variable check
J:\temp>SET NODE_DEBUG
NODE_DEBUG=cluster
J:\temp>
I've tried to find in the cluster.js any checks for NODE_DEBUG or any util.debuglog() calls and I could not find any.
Is this illustration still valid?
Is it not valid only for Windows?
Is this note after the illustration supposed to explain the output difference in Windows:
Please note that on Windows, it is not yet possible to set up a named pipe server in a worker.
Should the document fragment be somehow clarified more?
Metadata
Metadata
Assignees
Labels
clusterIssues and PRs related to the cluster subsystem.Issues and PRs related to the cluster subsystem.docIssues and PRs related to the documentations.Issues and PRs related to the documentations.