Skip to content

Commit

Permalink
cluster: avoid race enabling debugger in worker
Browse files Browse the repository at this point in the history
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: nodejs/node-v0.x-archive#6440
Original-PR-URL: nodejs/node-v0.x-archive#9037
Signed-off-by: Julien Gilli <julien.gilli@joyent.com>

Fixes: #340
PR-URL: #501
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Bert Belder <bertbelder@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
  • Loading branch information
tjfontaine authored and bnoordhuis committed Jan 19, 2015
1 parent 6b91c78 commit 4dd22b9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 4dd22b9

Please sign in to comment.