Browse Source

cluster: avoid race enabling debugger in worker

Previously if a worker's state machine had already transitioned into the
'listening' state when it received the message enabling the debugger,
the worker would never enable its debugger.

Change the logic to allow the 'listening' as a valid state for enabling
the debugger.

Fixes: https://github.com/joyent/node/issues/6440
Original-PR-URL: https://github.com/joyent/node/pull/9037
Signed-off-by: Julien Gilli <julien.gilli@joyent.com>

Fixes: https://github.com/iojs/io.js/issues/340
PR-URL: https://github.com/iojs/io.js/pull/501
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
v1.8.0-commit
Timothy J Fontaine 10 years ago
committed by Ben Noordhuis
parent
commit
4dd22b946e
  1. 2
      lib/cluster.js

2
lib/cluster.js

@ -266,7 +266,7 @@ function masterInit() {
var key;
for (key in cluster.workers) {
var worker = cluster.workers[key];
if (worker.state === 'online') {
if (worker.state === 'online' || worker.state === 'listening') {
process._debugProcess(worker.process.pid);
} else {
worker.once('online', function() {

Loading…
Cancel
Save