From e9df9a0216550abab4923bcfc6dea4f4b32368d2 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 #6440 Signed-off-by: Julien Gilli --- lib/cluster.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cluster.js b/lib/cluster.js index c76594ad7d34..71ebf41c454e 100644 --- a/lib/cluster.js +++ b/lib/cluster.js @@ -285,7 +285,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() {