rebooting node.js cluster workers
Problem
I have a node app I use cluster to run on multiple cores.
I'm running into an issue where when my app throws an exception, the Worker dies and doesn't restart. That makes sense, but I'm wondering if there is a better way to handle restarting these workers instead of having to monitor it or try/catch or listen for every error.
I've used forever before, and it seems like something like this would work well for cluster.
Is there a way to reboot them, or add "pokemon" exception handling at a top layer in express to make sure my workers won't die if there's an unexpected exception?
Solution
There are many 3rd party tools that can help with this. Monit (http://mmonit.com/monit/) is quite popular in the Node community. Another option, of many, is supervise
(http://cr.yp.to/daemontools.html).
Discussion
View additional discussion.