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 個月前檢視次數 180 次
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 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南