Pm2: [Question] Details about cause of restarting process

Created on 18 Apr 2014  路  2Comments  路  Source: Unitech/pm2

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?

Need More Data Question

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.

All 2 comments

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.

Was this page helpful?
0 / 5 - 0 ratings