Open sm1013t opened 3 years ago
I have the same problem in spades on EC2 instance. I'm doing something like if webA
running, start webB
and health check, wait 10, then delete webA
. The running process cannot be deleted more times than not. This completely grenades my instance, locks up CPU, and I can't SSH in. It's a nightmare and sporadic. I've tried to add to config file:
kill_timeout: 5000,
kill_retry_time: 2000,
restart_delay: 2000
I think I'll switch to systemd as I've tried everything in the docs to no avail, looked through the pm2 code, and don't understand why deleting a process would cause pm2 to eat itself. I was using sudo env PATH=$PATH:/usr/bin pm2 startup systemd -u ubuntu --hp /home/ubuntu
to be able to save the running process, but I think that might be related.
pm2 seems so cool, but for me it's been so unreliable I now consider it unusable.
2022-11-17T09:10:58: PM2 log: --- New PM2 Daemon started ---------------------------------------------------- 2022-11-17T09:10:58: PM2 log: Time : Thu Nov 17 2022 09:10:58 GMT+0800 (China Standard Time) 2022-11-17T09:10:58: PM2 log: PM2 version : 4.5.6 2022-11-17T09:10:58: PM2 log: Node.js version : 12.17.0 2022-11-17T09:10:58: PM2 log: Current arch : x64 2022-11-17T09:10:58: PM2 log: PM2 home : /root/.pm2 2022-11-17T09:10:58: PM2 log: PM2 PID file : /root/.pm2/pm2.pid 2022-11-17T09:10:58: PM2 log: RPC socket file : /root/.pm2/rpc.sock 2022-11-17T09:10:58: PM2 log: BUS socket file : /root/.pm2/pub.sock 2022-11-17T09:10:58: PM2 log: Application log path : /root/.pm2/logs 2022-11-17T09:10:58: PM2 log: Worker Interval : 30000 2022-11-17T09:10:58: PM2 log: Process dump file : /root/.pm2/dump.pm2 2022-11-17T09:10:58: PM2 log: Concurrent actions : 2 81 2022-11-17T09:10:58: PM2 log: SIGTERM timeout : 1600
2022-11-16T23:01:03: PM2 error: app=app001 id=5 pid=16172 could not be stopped 2022-11-16T23:01:03: PM2 error: Process with pid 16172 already exists 2022-11-16T23:01:03: PM2 error: Error: Process with pid 16172 already exists at Object.God.logAndGenerateError (/usr/local/xxx/nodejs/node-v12.17.0-linux-x64/lib/node_modules/pm2/lib/God/Methods.js:39:12) at Object.God.startProcessId (/usr/local/xxx/nodejs/node-v12.17.0-linux-x64/lib/node_modules/pm2/lib/God/ActionMethods.js:286:21) at /usr/local/xxx/nodejs/node-v12.17.0-linux-x64/lib/node_modules/pm2/lib/God/ActionMethods.js:432:20 at /usr/local/xxx/nodejs/node-v12.17.0-linux-x64/lib/node_modules/pm2/lib/God/ActionMethods.js:341:16 at Timeout._onTimeout (/usr/local/xxx/nodejs/node-v12.17.0-linux-x64/lib/node_modules/pm2/lib/God/Methods.js:176:16) at listOnTimeout (internal/timers.js:549:17) at processTimers (internal/timers.js:492:7) 2022-11-16T23:01:04: PM2 log: App [app001:5] exited with code [0] via signal [SIGKILL] 2022-11-16T23:01:04: PM2 log: App [app001:5] will restart in 3600000ms
I also had several situations where I couldn't stop the process. And the log doesn't say why it couldn't be stopped.
Agreed, I am using setInterval
in my nodejs application and this is causing the intervals to continue running even after I kill the process. This is a major issue!
Yup, getting the same issue. My memory is filling up on my docker instance. Even when the job is not running the process continues to live on
In my case it was out of memory errors due to docker thinking it had 8 cpus and forking the same number of processes.
The kill command sent to it doesn't kill the child processes, only the parent processes.
The exact same problem happened with dkron, too.
I was able to make everything work nicely, so not a problem with pm2.
Software Components: PM2 version: 4.4.1 , Windows 2016 server, Node.js version : 12.13.1
PM2 stop , doesn't stop the process. It shows the status as "errored".
When I check the process in Windows Task Manager, I see the application process running even after Pm2 stop .
Also, tried with increasing the Kill Timeout as well as with forceful (-f) option , but no luck.
Below is the log message even if there is no traffic -
2020-09-21T23:47:29: PM2 log: pid=9916 msg=failed to kill - retrying in 100ms 2020-09-21T23:47:29: PM2 log: pid=9916 msg=failed to kill - retrying in 100ms 2020-09-21T23:47:29: PM2 log: pid=9916 msg=failed to kill - retrying in 100ms 2020-09-21T23:47:29: PM2 log: Process with pid 9916 could not be killed 2020-09-21T23:47:29: PM2 error: app=testMS id=1 pid=9916 could not be stopped
As a workaround, I'm doing with "pm2 delete all" ; and then "pm2 restart all"
But, I have some requirement where I need to stop with - "pm2 stop" only