process has been automatically restarted by PM2

0

I sometimes (lately once a week) receive notifications from PM2 Plus that some of my applications have been restarted, type: automatic.

PM2 is running inside an ECS instance. The memory utilization is close to 99% (all the time). The CPU has spikes, sometimes going up to 133% utilization.

How can I find the cause of the application restarts by PM2? PM2 detail logs? What are your guidelines regarding PM2 configuration? How about load balancing at ECS level vs at PM2 level?

Thank you!

Adrian
已提问 4 个月前178 查看次数
1 回答
0

Hi,

Try setting up CloudWatch agent as a container in your ECS task which pushes all the logs(include PM2 logs) to CloudWatch and allows you to debug things. Follow this blog to setup CloudWatch agent in ECS task https://aws.amazon.com/blogs/devops/send-ecs-container-logs-to-cloudwatch-logs-for-centralized-monitoring/

PM2 restart reasons are a few:

  • Application crash
  • Empty event loop

As your memory utilization is close to 99%, try finding any data leak is happening inside the application.

Let me know if you have any questions

profile picture
已回答 4 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则