Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pm2 stop does not kill app process on Windows 7 #1664

Closed
malcoriel opened this issue Oct 3, 2015 · 2 comments · Fixed by #1727
Closed

pm2 stop does not kill app process on Windows 7 #1664

malcoriel opened this issue Oct 3, 2015 · 2 comments · Fixed by #1727

Comments

@malcoriel
Copy link

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' } ).

@craigbroadbear
Copy link

I was having the same problem on windows 10 and the suggested fix worked.

@kflu
Copy link
Contributor

kflu commented Oct 29, 2015

Yep, I confirm this fix works too. It also fixes the problem that pm2 start <file> --watch won't recycle the app on modification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants