-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Specify debug port per worker #5318
Comments
I was also following issue #130 and none of the alternatives posted there works for us. Kind of frustrated around this, so +10 |
Having the same issue here and it is frustrating. |
We'll address that in due time. The cluster module is scheduled for rework anyway. Until then, you can use something like this: var cluster = require('cluster');
var http = require('http');
if (cluster.isMaster) {
var debug = process.execArgv.indexOf('--debug') !== -1;
cluster.setupMaster({
execArgv: process.execArgv.filter(function(s) { return s !== '--debug' })
});
for (var i = 0; i < 2; ++i) {
if (debug) cluster.settings.execArgv.push('--debug=' + (5859 + i));
cluster.fork();
if (debug) cluster.settings.execArgv.pop();
}
}
else {
var server = http.createServer(function(req, res) {
res.end('OK');
});
server.listen(8000);
} It's improper use of the API (cluster.settings should be considered immutable) but this snippet works with v0.10. |
Implement support for debugging cluster workers. Each worker process is assigned a new debug port in an increasing sequence. I.e. when master process uses port 5858, then worker 1 uses port 5859, worker 2 uses port 5860, and so on. Introduce new command-line parameter '--debug-port=' which sets debug_port but does not start debugger. This option works for all node processes, it is not specific to cluster workers. Fixes nodejs#5318. (cherry picked from commit 43ec1b1) Conflicts: src/node.cc
Implement support for debugging cluster workers. Each worker process is assigned a new debug port in an increasing sequence. I.e. when master process uses port 5858, then worker 1 uses port 5859, worker 2 uses port 5860, and so on. Introduce new command-line parameter '--debug-port=' which sets debug_port but does not start debugger. This option works for all node processes, it is not specific to cluster workers. Fixes nodejs#5318.
Implement support for debugging cluster workers. Each worker process is assigned a new debug port in an increasing sequence. I.e. when master process uses port 5858, then worker 1 uses port 5859, worker 2 uses port 5860, and so on. Introduce new command-line parameter '--debug-port=' which sets debug_port but does not start debugger. This option works for all node processes, it is not specific to cluster workers. Fixes nodejs#5318. Conflicts: src/node.cc
@bnoordhuis @bajtos Any plans to backport the proper to v0.10 (including the -port command line arg)? |
@benfleis that would be a behavior change, I think. This could be done only in unstable branches. |
@indutny Makes sense. Thanks :) |
I think a similar problem is happening when using Failed to open socket on port 5858, waiting 1000 ms before retrying I guess we can override this using arguments, but the documentation is not opening my eyes yet. |
Workaround, something like this before you
|
In which version is this working properly? |
Hi,
Currently it looks impossible to debug worker processes. Here is a discussion related with node-inspector:
node-inspector/node-inspector#130
Is it possible to add ability to change the debug ports for the workers?
Thanks
The text was updated successfully, but these errors were encountered: