according to many articles, the best way to handle uncaught exceptions in a node.js app is let the process crash and than restart it. This avoids to have our application in a unstable state. I think it can be done with an external process like a watchdog (sometimes called angel process). What is the best way to do this in a linux system? At first glance a bash script checking the node process state every n seconds could be a possible solution. Thank in advance, any suggestion will be really appreciated.
Node.js Best Practice Exception Handling
There are a handful of solutions like the watchdog/angel process you mention. The one you most often hear thrown around is "forever". It's available via npm.
To install, just: npm install -g forever
Then when you want to run your app: forever app.js
instead of node app.js