You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a worker, this function will close all servers, wait for the 'close' event on those servers, and then disconnect the IPC channel.
Causes .suicide to be set.
Repro:
varcluster=require('cluster');if(cluster.isMaster){// Master forks and listens for eventsvarworker=cluster.fork();cluster.on('disconnect',function(){console.log("disconnect",worker.suicide);});cluster.on('exit',function(){console.log("exit",worker.suicide);});}else{// Worker just disconnectscluster.worker.disconnect();}
In node v0.10, both log statements would print true for worker.suicide. In 41b75ca, which landed during the v0.11 branch, this was broken, and all versions up to node v4 will print false. This is because worker.disconnect(), when called from the worker, does not send the suicide message anymore -- only worker.destroy() will send that message to the master.
From the documentation:
worker.suicide:worker.disconnect():Repro:
In node v0.10, both log statements would print
trueforworker.suicide. In 41b75ca, which landed during the v0.11 branch, this was broken, and all versions up to node v4 will printfalse. This is becauseworker.disconnect(), when called from the worker, does not send thesuicidemessage anymore -- onlyworker.destroy()will send that message to the master.