summaryrefslogtreecommitdiff
path: root/lib/cluster.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2015-10-24 11:51:10 -0700
committerRich Trott <rtrott@gmail.com>2015-10-27 09:55:15 -0700
commitda21dba1a001eb85dbf720e142a1b94778e9a9f7 (patch)
treecd3b47e8cfe8a8e31f850236f5494557844bf8ac /lib/cluster.js
parentc339fa36f5493c2bd2e108463910122ef82843c4 (diff)
downloadandroid-node-v8-da21dba1a001eb85dbf720e142a1b94778e9a9f7.tar.gz
android-node-v8-da21dba1a001eb85dbf720e142a1b94778e9a9f7.tar.bz2
android-node-v8-da21dba1a001eb85dbf720e142a1b94778e9a9f7.zip
lib: fix cluster handle leak
It is possible to cause a resource leak in SharedHandle. This commit fixes the leak. Fixes: https://github.com/nodejs/node/issues/2510 PR-URL: https://github.com/nodejs/node/pull/3510 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'lib/cluster.js')
-rw-r--r--lib/cluster.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/cluster.js b/lib/cluster.js
index 602cc8d60b..eef8bd2563 100644
--- a/lib/cluster.js
+++ b/lib/cluster.js
@@ -345,7 +345,10 @@ function masterInit() {
* if it has disconnected, otherwise we might
* still want to access it.
*/
- if (!worker.isConnected()) removeWorker(worker);
+ if (!worker.isConnected()) {
+ removeHandlesForWorker(worker);
+ removeWorker(worker);
+ }
worker.suicide = !!worker.suicide;
worker.state = 'dead';