diff options
author | cjihrig <cjihrig@gmail.com> | 2016-05-20 15:05:02 -0400 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2016-05-25 11:58:02 -0400 |
commit | 33c7b45378777ddff6dad1a74095d0d8d155f56d (patch) | |
tree | 41a5777a181150e07543391f662331a6363404da /lib | |
parent | 9140b97848fb284ec17b87e8933a1e2cb2a7521c (diff) | |
download | android-node-v8-33c7b45378777ddff6dad1a74095d0d8d155f56d.tar.gz android-node-v8-33c7b45378777ddff6dad1a74095d0d8d155f56d.tar.bz2 android-node-v8-33c7b45378777ddff6dad1a74095d0d8d155f56d.zip |
cluster: guard against undefined message handlers
cluster's internal message handling includes a cache of callback
functions. Once the message for that callback is received, it is
removed from the cache. If, for any reason, the same message ID
is processed twice, the callback will be missing from the cache
and cluster will try to call undefined as a function. This commit
guards against this scenario.
Refs: https://github.com/nodejs/node/issues/6561
PR-URL: https://github.com/nodejs/node/pull/6902
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cluster.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/cluster.js b/lib/cluster.js index 175645f713..68a772a74a 100644 --- a/lib/cluster.js +++ b/lib/cluster.js @@ -749,7 +749,7 @@ function internal(worker, cb) { return function(message, handle) { if (message.cmd !== 'NODE_CLUSTER') return; var fn = cb; - if (message.ack !== undefined) { + if (message.ack !== undefined && callbacks[message.ack] !== undefined) { fn = callbacks[message.ack]; delete callbacks[message.ack]; } |