Pm2: Cluster process not killed when listening on SIGINT process

Created on 1 Apr 2016  ยท  5Comments  ยท  Source: Unitech/pm2

1983 #1974 #1748 #1043 #2043 #1702 #1422

Replace Node.js process.kill by treeKill

Bug: pid can not be killed Error: kill ESRCH

Bug

Most helpful comment

I've had this occur on a recent version of pm2. The app that crashed is #3, and has been renamed to APPNAME for privacy reasons. Unrelated applications renamed to APP. As you can see, I had to run pm2 update, and then kill it after it hung, before running it again.

If this occurs again, is there anything I can do to log with additional verbosity when running pm2 update? Might be able to determine what causes it to hang, and perhaps that would aid in root cause analysis.

pm2 -v
2.10.1

$ pm2 start APPNAME
[PM2] Applying action restartProcessId on app APPNAME
[PM2][ERROR] Process 3 not found
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ App name โ”‚ id โ”‚ mode โ”‚ pid โ”‚ status โ”‚ restart โ”‚ uptime โ”‚ cpu โ”‚ mem โ”‚ user โ”‚ watching โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ APP โ”‚ 1 โ”‚ fork โ”‚ 14625 โ”‚ online โ”‚ 1 โ”‚ 11D โ”‚ 0% โ”‚ 52.1 MB โ”‚ user โ”‚ disabled โ”‚
โ”‚ APP โ”‚ 2 โ”‚ fork โ”‚ 1819 โ”‚ online โ”‚ 436 โ”‚ 39h โ”‚ 0% โ”‚ 127.4 MB โ”‚ user โ”‚ disabled โ”‚
โ”‚ APP โ”‚ 4 โ”‚ fork โ”‚ 5412 โ”‚ online โ”‚ 0 โ”‚ 20D โ”‚ 0% โ”‚ 44.4 MB โ”‚ user โ”‚ disabled โ”‚
โ”‚ APP โ”‚ 0 โ”‚ fork โ”‚ 0 โ”‚ errored โ”‚ 15 โ”‚ 0 โ”‚ 0% โ”‚ 0 B โ”‚ user โ”‚ disabled โ”‚
โ”‚ APPNAME โ”‚ 3 โ”‚ fork โ”‚ 5406 โ”‚ stopped โ”‚ 1 โ”‚ 0 โ”‚ 0% โ”‚ 0 B โ”‚ user โ”‚ disabled โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

$ pm2 stop APPNAME
[PM2] Applying action stopProcessId on app APPNAME
[PM2] [APPNAME](3) โœ“

$ pm2 start APPNAME
[PM2] Applying action restartProcessId on app APPNAME
[PM2][ERROR] Process 3 not found

pm2 update
Be sure to have the latest version by doing npm install pm2@latest -g before doing this procedure.
[PM2] Saving current process list...
[PM2] Stopping PM2...
[PM2] Applying action deleteProcessId on app all
[PM2] [all](0) โœ“
(hangs)
(ctrl+c)

pm2 update
Be sure to have the latest version by doing npm install pm2@latest -g before doing this procedure.
[PM2] Saving current process list...
[PM2] Stopping PM2...
[PM2] Applying action deleteProcessId on app all
[PM2] [APPNAME](3) โœ“
[PM2] [APP](2) โœ“
[PM2] [APP](1) โœ“
[PM2] [APP](4) โœ“
[PM2] All processes have been stopped and deleted
[PM2] PM2 stopped
[PM2] Spawning PM2 daemon with pm2_home=/home/user/.pm2
[PM2] Restoring processes located in /home/user/.pm2/dump.pm2
[PM2] Process APP restored
[PM2] Process APP restored
[PM2] Process APPNAME restored
[PM2] Process APP restored

PM2 updated

All 5 comments

Update available ([email protected] - latest stable):

$ npm install pm2@latest -g
$ pm2 update

Please re-open this issue if you notice any problem,

I've had this occur on a recent version of pm2. The app that crashed is #3, and has been renamed to APPNAME for privacy reasons. Unrelated applications renamed to APP. As you can see, I had to run pm2 update, and then kill it after it hung, before running it again.

If this occurs again, is there anything I can do to log with additional verbosity when running pm2 update? Might be able to determine what causes it to hang, and perhaps that would aid in root cause analysis.

pm2 -v
2.10.1

$ pm2 start APPNAME
[PM2] Applying action restartProcessId on app APPNAME
[PM2][ERROR] Process 3 not found
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ App name โ”‚ id โ”‚ mode โ”‚ pid โ”‚ status โ”‚ restart โ”‚ uptime โ”‚ cpu โ”‚ mem โ”‚ user โ”‚ watching โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ APP โ”‚ 1 โ”‚ fork โ”‚ 14625 โ”‚ online โ”‚ 1 โ”‚ 11D โ”‚ 0% โ”‚ 52.1 MB โ”‚ user โ”‚ disabled โ”‚
โ”‚ APP โ”‚ 2 โ”‚ fork โ”‚ 1819 โ”‚ online โ”‚ 436 โ”‚ 39h โ”‚ 0% โ”‚ 127.4 MB โ”‚ user โ”‚ disabled โ”‚
โ”‚ APP โ”‚ 4 โ”‚ fork โ”‚ 5412 โ”‚ online โ”‚ 0 โ”‚ 20D โ”‚ 0% โ”‚ 44.4 MB โ”‚ user โ”‚ disabled โ”‚
โ”‚ APP โ”‚ 0 โ”‚ fork โ”‚ 0 โ”‚ errored โ”‚ 15 โ”‚ 0 โ”‚ 0% โ”‚ 0 B โ”‚ user โ”‚ disabled โ”‚
โ”‚ APPNAME โ”‚ 3 โ”‚ fork โ”‚ 5406 โ”‚ stopped โ”‚ 1 โ”‚ 0 โ”‚ 0% โ”‚ 0 B โ”‚ user โ”‚ disabled โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

$ pm2 stop APPNAME
[PM2] Applying action stopProcessId on app APPNAME
[PM2] [APPNAME](3) โœ“

$ pm2 start APPNAME
[PM2] Applying action restartProcessId on app APPNAME
[PM2][ERROR] Process 3 not found

pm2 update
Be sure to have the latest version by doing npm install pm2@latest -g before doing this procedure.
[PM2] Saving current process list...
[PM2] Stopping PM2...
[PM2] Applying action deleteProcessId on app all
[PM2] [all](0) โœ“
(hangs)
(ctrl+c)

pm2 update
Be sure to have the latest version by doing npm install pm2@latest -g before doing this procedure.
[PM2] Saving current process list...
[PM2] Stopping PM2...
[PM2] Applying action deleteProcessId on app all
[PM2] [APPNAME](3) โœ“
[PM2] [APP](2) โœ“
[PM2] [APP](1) โœ“
[PM2] [APP](4) โœ“
[PM2] All processes have been stopped and deleted
[PM2] PM2 stopped
[PM2] Spawning PM2 daemon with pm2_home=/home/user/.pm2
[PM2] Restoring processes located in /home/user/.pm2/dump.pm2
[PM2] Process APP restored
[PM2] Process APP restored
[PM2] Process APPNAME restored
[PM2] Process APP restored

PM2 updated

I am having the same issue on version 3.1.3.

I'm having this issue too

I'm having this issue too

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chaos-git picture chaos-git  ยท  3Comments

mario-mui picture mario-mui  ยท  3Comments

phra picture phra  ยท  3Comments

ldarren picture ldarren  ยท  3Comments

liujb picture liujb  ยท  3Comments