0

I Have node apps unning using pm2.And it is spawning multiple pm2 daemon instead of one which is eating up all the memory.

When I run ps aux | grep pm2 Command I see multiple God daemons for the pm2 process instead of one. I have a total of 10 pm2 processes for which there should be only one God Daemon. I have installed pm2 globally and it is running by user appuser. Can anyone tell me how can I fix this?

appuser    930  0.0  0.2 573196 10532 ?        Sl   Aug17   0:00 node /opt/node/bin/pm2 start /opt/pm2-config/dj.json
appuser    931  0.0  0.2 572900  9688 ?        Sl   Aug17   0:00 node /opt/node/bin/pm2 start /opt/pm2-config/dj-ui.json
appuser    938  0.0  0.2 572648  9640 ?        Sl   Aug17   0:00 node /opt/node/bin/pm2 start /opt/pm2-config/custom-dj-ui.json
appuser    939  0.0  0.2 573084  9672 ?        Sl   Aug17   0:00 node /opt/node/bin/pm2 start /opt/pm2-config/qa-custom-dj.json
appuser    947  0.0  0.2 572692 10436 ?        Sl   Aug17   0:00 node /opt/node/bin/pm2 start /opt/pm2-config/preview-custom-dj.json
appuser    960  0.0  0.2 573100 10564 ?        Sl   Aug17   0:00 node /opt/node/bin/pm2 start /opt/pm2-config/dev-custom-api.json
appuser    963  0.0  0.2 573408 10100 ?        Sl   Aug17   0:00 node /opt/node/bin/pm2 start /opt/pm2-config/qa-custom-api.json
appuser    967  0.0  0.2 572824  9848 ?        Sl   Aug17   0:00 node /opt/node/bin/pm2 start /opt/pm2-config/preview-custom-dj.json
appuser    968  0.0  0.2 573352 10212 ?        Sl   Aug17   0:00 node /opt/node/bin/pm2 start /opt/pm2-config/preview-custom-api.json
appuser   1890  0.0  0.4 682036 19636 ?        Ssl  Aug17   0:01 PM2 v4.4.0: God Daemon (/naught-home/.pm2)
appuser   1893  0.0  0.4 681716 18728 ?        Ssl  Aug17   0:01 PM2 v4.4.0: God Daemon (/naught-home/.pm2)
appuser   1907  0.0  0.5 682092 20104 ?        Ssl  Aug17   0:01 PM2 v4.4.0: God Daemon (/naught-home/.pm2)
appuser   1916  0.0  0.5 681808 21412 ?        Ssl  Aug17   0:01 PM2 v4.4.0: God Daemon (/naught-home/.pm2)
appuser   1917  0.0  0.5 682064 19856 ?        Ssl  Aug17   0:01 PM2 v4.4.0: God Daemon (/naught-home/.pm2)
appuser   1918  0.0  0.4 681800 19200 ?        Ssl  Aug17   0:01 PM2 v4.4.0: God Daemon (/naught-home/.pm2)
appuser   1923  0.0  0.4 682088 19288 ?        Ssl  Aug17   0:01 PM2 v4.4.0: God Daemon (/naught-home/.pm2)
appuser   1931  0.0  0.4 682308 19404 ?        Ssl  Aug17   0:01 PM2 v4.4.0: God Daemon (/naught-home/.pm2)
appuser   1941  0.0  0.4 681712 19196 ?        Ssl  Aug17   0:01 PM2 v4.4.0: God Daemon (/naught-home/.pm2)```

1 Answers1

0

We fixed the above issue by removing the update-rc.d entries for pm2 services which were causing the extra node and pm2 process to start. Also to start the services at reboot, we added the start script in cronjob.