1

I am using Express as my Node.js web framework with MongoDB as persistence layer. When I run the server with 'node app.js' command, and occasionally some error occur such as mongoose error or imagemagick error, the hole node process will die and not available from browser. I used Express' error handler but this is still happening. Can someone help?

3
  • What version of node are you using? I got around this using the clusters package and the process.on('death') message. Look at the example code for clusters on the node.js website Commented Apr 16, 2012 at 1:45
  • 1
    @zhangxuefeng post this as an answer and then accept it - that way, other people with the same problem will see that there is a solution Commented Apr 16, 2012 at 8:49
  • Duplicate of stackoverflow.com/questions/5999373/… Commented Apr 16, 2012 at 9:59

2 Answers 2

2
process.on('uncaughtException', function (err) {
  console.error(err);
  console.log("Node NOT Exiting...");
});
Sign up to request clarification or add additional context in comments.

Comments

0
clusters.on('death', function(worker) {
  app.listen(3000);
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.