Harish Mahajan
Harish Mahajan

Reputation: 3294

pm2 process crashed on server. it gives an error

suddenly i received this error in my terminal.

[RangeError: Maximum call stack size exceeded]

I have used pm2 for it. And one of my process is restart autometically. Can you tell me why such happen? Or is there any other solutions for it? Please suggest me for it.

Upvotes: 1

Views: 1733

Answers (1)

Mrugank Dhimmar
Mrugank Dhimmar

Reputation: 202

you can increase the size of memory restart by doing below things

pm2 start process.js --max-memory-restart 2G (newer pm2 version)
pm2 start process.js --max-stack-size=65000" (older pm2 version)

And add below lines in your node.js file.

process.on('uncaughtException', function(err) {
 console.log('Caught exception: ' + err);
 console.log(err.stack);
});

for more detail : pm2

Upvotes: 1

Related Questions