cluster: do not unconditionally set --debug-port
authorcjihrig <cjihrig@gmail.com>
Thu, 11 Jun 2015 15:47:52 +0000 (11:47 -0400)
committerRod Vagg <rod@vagg.org>
Tue, 4 Aug 2015 18:56:12 +0000 (11:56 -0700)
commit423d8944ce58bc8c3f90d2827339a4dea10ab96e
treeb1d522f47ae02bac0bc9f70b9859acf6178682b7
parenteea66e2a7b34f10e723b5f3efa3efb2e2d30aafe
cluster: do not unconditionally set --debug-port

Currently, each cluster worker is assigned an ever increasing
--debug-port argument. A long running cluster application that
does not use the debugger can run into errors related to the
port range. This commit mitigates the problem by only setting
the debug port if the master is started with debug arguments, or
the user explicitly defines debug arguments for the worker. This
commit also adds a new debug port offset counter that is only
incremented when a worker is created that utilizes debugging.

Fixes: https://github.com/joyent/node/issues/8159
Refs: https://github.com/nodejs/io.js/pull/1524
PR-URL: https://github.com/nodejs/io.js/pull/1949
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Oleg Elifantiev <oleg@elifantiev.ru>
lib/cluster.js
test/parallel/test-cluster-debug-port.js [new file with mode: 0644]