diff --git a/lib/cluster.js b/lib/cluster.js index e05de4568bc6..5f0edcff0959 100644 --- a/lib/cluster.js +++ b/lib/cluster.js @@ -360,6 +360,14 @@ function masterInit() { } worker.process.once('exit', function(exitCode, signalCode) { + /* + * Remove the handles associated with this + * worker a second time just in case 'disconnect' + * event isn't emitted. + */ + if (worker.state != 'disconnected') + removeHandlesForWorker(worker); + /* * Remove the worker from the workers list only * if it has disconnected, otherwise we might