Score:0

pm2 Multiple God Daemons and node process Spawning

ng flag

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)```

Michael Hampton avatar
cz flag
Why do you use pm2? You could just start your app from systemd directly.
Sterina Pen avatar
ng flag
We manage the node service with pm2, and we manage pm2 via a init.d service file which is located at /etc/init.d/service-file.
Score:0
ng flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.