From 4dd22b946ebfec81a7c4a61aa9c6ed528e317802 Mon Sep 17 00:00:00 2001 From: Timothy J Fontaine Date: Thu, 15 Jan 2015 23:14:16 +0000 Subject: [PATCH] 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 Fixes: https://github.com/iojs/io.js/issues/340 PR-URL: https://github.com/iojs/io.js/pull/501 Reviewed-By: Ben Noordhuis Reviewed-By: Bert Belder Reviewed-By: Rod Vagg --- lib/cluster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cluster.js b/lib/cluster.js index 6e4dc4004e..1051291312 100644 --- a/lib/cluster.js +++ b/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() {