admin管理员组文章数量:1323023
I have a staging and production server both running a Sails.js app (www.sailsjs). I have experienced pm2 restarting my app randomly without at correlation or pattern. I've checked the following for any pattern: - Memory usage leading up to restart - sometimes it's ~320MB and others it's ~410MB - Events/Requests/Errors nothing in my Nginx, Node, PM2, or App logs show errors or any concerns
This happens in both staging and production servers in cluster mode or fork. It does NOT happen locally, at least I haven't experienced it.
Info Servers: Digitalocean droplets 2GB RAM 2 CPU/Core Ubuntu 14.04 lts Node: v4.4 PM2: 1.0.2
Also, the pm2 list
mand shows the app running for 3h but says there have been zero restarts when I know for a fact the app has been running for several days. I also have a keymetrics.io account that monitors the server which shows me the restarts of pm2 (the pm2.log correlates these restarts):
I have a staging and production server both running a Sails.js app (www.sailsjs). I have experienced pm2 restarting my app randomly without at correlation or pattern. I've checked the following for any pattern: - Memory usage leading up to restart - sometimes it's ~320MB and others it's ~410MB - Events/Requests/Errors nothing in my Nginx, Node, PM2, or App logs show errors or any concerns
This happens in both staging and production servers in cluster mode or fork. It does NOT happen locally, at least I haven't experienced it.
Info Servers: Digitalocean droplets 2GB RAM 2 CPU/Core Ubuntu 14.04 lts Node: v4.4 PM2: 1.0.2
Also, the pm2 list
mand shows the app running for 3h but says there have been zero restarts when I know for a fact the app has been running for several days. I also have a keymetrics.io account that monitors the server which shows me the restarts of pm2 (the pm2.log correlates these restarts):
1 Answer
Reset to default 6If you look at the PM2 help, pm2 --help
, you will see an option --no-autorestart
which says start an app without automatic restart
. That should do it.
But you want PM2 to to be able to restart when it is out of memory. You can increase the max memory until restart with the --max-memory-restart
option.
Example with max-memory-restart
set to 5000mb:
PM2 start --name my-process --max-memory-restart 5000M index.js
本文标签: javascriptpm2 app restarts randomly without reasonStack Overflow
版权声明:本文标题:javascript - pm2 app restarts randomly without reason - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742111120a2421260.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论