Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


does not work with cluster #40

tjanczuk opened this Issue · 6 comments

3 participants


node 0.6.4, supervisor 0.2.0, Darwin 11.2.0

A node.js application that creates child processes with the built-in cluster functionality does not restart when the main application file changes. The same works fine without cluster.

Supervisor prints out "DEBUG: crashing" but the node processes do not seem to be terminated.


Hmm, this is the same behavior that happens if I start a cluster with node and then manually kill the master process - the children keep running. Is there something supervisor can do about this? Or is it up to the program spawning the cluster?


+1 on this. Would be really awesome if supervisor worked with cluster.


I'm still not clear on what supervisor should be doing here. If it doesn't spawn the cluster, I don't think it can know to kill the child processes when it reboots the app.

I think the app itself needs to do something like this:

var signals = ['SIGINT', 'SIGTERM', 'SIGQUIT'];
for (i in signals) {
  process.on(signals[i], function() {
    for (j in children) {

That will make sure that children are killed off when the master process is. If your app does this, it works great with supervisor.


From the supervisor's perspective I think you are right. The core of the issue I think is whether node.js cluster should kill the entire process tree when the master process is killed. That was what I was intuitively expecting to happen.


Yeah, I agree that's a bit unexpected. Unfortunately it's an upstream issue.


Ian's suggestion seems to work pretty nicely. Added it here:

Many thanks!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.