What are some ways to help figure out why a process was restarted? We can see the exit code in pm2.log, but it's not very simple to pair that with the error that happened right before the exit (unless the errors are timestamped somehow).
Would it be possible to include the last error message right before lines like these in pm2.log?
Script myapp 1 exited code 143
Or are there some other ways to track down the cause of a restart?
What about the process running out of memory - is this tracked in the pm2.log?
Can't your app do this on it's own:
process.on('uncaughtException', function(err) {
// do some logging
})
@dandv What was your resolution with this? I'm experiencing random restarts with pm2 in fork & cluster mode but no uncaughtExceptions are logged... Just researching and trying to see what other people have found.
Most helpful comment
@dandv What was your resolution with this? I'm experiencing random restarts with pm2 in fork & cluster mode but no
uncaughtExceptions are logged... Just researching and trying to see what other people have found.