Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.13k stars 2.6k forks source link

Startup Issue with CentOS8 #4776

Open itoutcome opened 4 years ago

itoutcome commented 4 years ago

Fresh Install of CentOS8 (8.2 to be more exact), node v12 (also tried v14 with the same results) and pm2

ran "pm2 startup" and after a restart, this keeps happening every 90 seconds (with or without an app started in pm2):

PM2 | pm2 has been killed by signal, dumping process list before exit... PM2 | Exited peacefully PM2 | pm2 has been killed by signal, dumping process list before exit... PM2 | Exited peacefully PM2 | pm2 has been killed by signal, dumping process list before exit... PM2 | Exited peacefully

Supporting information

I also removed 4.4.0 and installed 3.5.0, but the issue remains the same.

The only thing that helps is going to /etc/systemd/system/pm2-root.service and commenting the line: PIDFile=/root/.pm2/pm2.pid

Hope that helps

Report:

PM2 | 2020-07-09T15:55:11: PM2 log: SIGTERM timeout : 1600 PM2 | 2020-07-09T15:55:11: PM2 log: =============================================================================== PM2 | 2020-07-09T15:56:41: PM2 log: pm2 has been killed by signal, dumping process list before exit... PM2 | 2020-07-09T15:56:41: PM2 log: Exited peacefully PM2 | 2020-07-09T15:56:42: PM2 log: =============================================================================== PM2 | 2020-07-09T15:56:42: PM2 log: --- New PM2 Daemon started ---------------------------------------------------- PM2 | 2020-07-09T15:56:42: PM2 log: Time : Thu Jul 09 2020 15:56:42 GMT+0300 (Eastern European Summer Time) PM2 | 2020-07-09T15:56:42: PM2 log: PM2 version : 4.4.0 PM2 | 2020-07-09T15:56:42: PM2 log: Node.js version : 12.16.1 PM2 | 2020-07-09T15:56:42: PM2 log: Current arch : x64 PM2 | 2020-07-09T15:56:42: PM2 log: PM2 home : /root/.pm2 PM2 | 2020-07-09T15:56:42: PM2 log: PM2 PID file : /root/.pm2/pm2.pid PM2 | 2020-07-09T15:56:42: PM2 log: RPC socket file : /root/.pm2/rpc.sock PM2 | 2020-07-09T15:56:42: PM2 log: BUS socket file : /root/.pm2/pub.sock PM2 | 2020-07-09T15:56:42: PM2 log: Application log path : /root/.pm2/logs PM2 | 2020-07-09T15:56:42: PM2 log: Worker Interval : 30000 PM2 | 2020-07-09T15:56:42: PM2 log: Process dump file : /root/.pm2/dump.pm2 PM2 | 2020-07-09T15:56:42: PM2 log: Concurrent actions : 2 PM2 | 2020-07-09T15:56:42: PM2 log: SIGTERM timeout : 1600 PM2 | 2020-07-09T15:56:42: PM2 log: ===============================================================================

itoutcome commented 3 years ago

Nobody seems to be in a real hurry, but for whom it may concern, I've also posted on stackoverflow and added the things I discovered on my own there. I hope a fix will be added soon.

https://stackoverflow.com/questions/62814539/pm2-keeps-getting-killed-every-90-seconds-on-centos-8/

emreacar commented 3 years ago

Same issue for me. It reset app every 90sec.

This solved my problem.

The only thing that helps is going to /etc/systemd/system/pm2-root.service and commenting the line: PIDFile=/root/.pm2/pm2.pid

Interestingly, I use centos 8 on two servers. I only encountered this problem in one.

itoutcome commented 3 years ago

You probably have selinux activated on only one of them. Did you read my stackoverflow post? It is listed above.

epexa commented 3 years ago

Related issue #4813

epexa commented 3 years ago

You probably have selinux activated on only one of them. Did you read my stackoverflow post? It is listed above.

@itoutcome It's not safe to disable SE Linux.

epexa commented 3 years ago

This method is the best at the moment:

Edit file: /etc/systemd/system/pm2-root.service

  1. Add new line: Environment=PM2_PID_FILE_PATH=/run/pm2.pid

  2. And replace: PIDFile=/root/.pm2/pm2.pid to: PIDFile=/run/pm2.pid

Versions:

Original answer. Thanks Alec!

robsch commented 3 years ago

Solution of @epexa was not working for me, unfortunately. I finally got it working with this one:

ausearch -c 'systemd' --raw | audit2allow -M my-systemd semodule -i my-systemd.pp

Which was described here...

Treeskull4920 commented 5 months ago

Same issue for me. It reset app every 90sec.

This solved my problem.

The only thing that helps is going to /etc/systemd/system/pm2-root.service and commenting the line: PIDFile=/root/.pm2/pm2.pid

Interestingly, I use centos 8 on two servers. I only encountered this problem in one.

This worked for me as well!