Description
Environment
pm2 --version 0.15.7
node --version v0.12.2
Windows 7 x64 SP1
head -n 50 ~/.pm2/pm2.log
2015-10-03 13:11:23: [PM2][WORKER] Started with refreshing interval: 30000
2015-10-03 13:11:23: [[[[ PM2/God daemon launched ]]]]
2015-10-03 13:11:23: BUS system [READY] on port .\pipe\pub.sock
2015-10-03 13:11:23: RPC interface [READY] on port .\pipe\rpc.sock
2015-10-03 13:11:23: Starting execution sequence in -fork mode- for app name:server id:0
2015-10-03 13:11:23: App name:server id:0 online
2015-10-03 13:11:29: Stopping app:server id:0
2015-10-03 13:11:29: 8648 pid can not be killed { [Error: kill ESRCH] code: 'ESRCH', errno: 'ESRCH', syscall: 'kill' }
2015-10-03 13:11:35: PM2 is being killed via kill method
2015-10-03 13:11:35: RPC socket closed
2015-10-03 13:11:35: PUB socket closed
2015-10-03 13:11:46: [PM2][WORKER] Started with refreshing interval: 30000
2015-10-03 13:11:46: [[[[ PM2/God daemon launched ]]]]
2015-10-03 13:11:46: BUS system [READY] on port .\pipe\pub.sock
2015-10-03 13:11:46: RPC interface [READY] on port .\pipe\rpc.sock
2015-10-03 13:11:46: Starting execution sequence in -fork mode- for app name:server id:0
2015-10-03 13:11:46: App name:server id:0 online
2015-10-03 13:11:50: Stopping app:server id:0
2015-10-03 13:11:50: App name:server id:0 exited with code 1
2015-10-03 13:11:50: Process with pid 6464 killed
2015-10-03 13:11:57: PM2 is being killed via kill method
2015-10-03 13:11:57: RPC socket closed
2015-10-03 13:11:57: PUB socket closed
What happens, and how to reporoduce
pm2 installed in node_modules, node_modules.bin is in PATH. Cluster mode is not used.
After trying to launch and stop my app with pm2 I have discovered that the app process is not killed. What I did:
$ pm2 start server/server.js
$ pm2 stop 0
After that, app process is still working.
$ pm2 kill
That kills pm2 and app process.
Code modification that fixes it:
/lib/God/Methods.js, line 245
process.kill(-(parseInt(pid)), 'SIGINT');
Should be changed to
process.kill((parseInt(pid)), 'SIGINT');
After that, 'pm2 stop 0' works normally.
The whole sequence of actions is reporduced in pm2.log above.
Updating node to v4.1.1 does not help (error in log is same: 4868 pid can not be killed { [Error: kill ESRCH] code: 'ESRCH', errno: 'ESRCH', syscall: 'kill' } ).