node-phantom
node-phantom copied to clipboard
When calling exit(), added call to phantom.kill()
Calling exit() doesn't terminate the spawned process. So I added a call to phantom.kill() to do the trick.
Fixes #24
oh thank god. that explains why phantom never dies for me.
This does not work for me. Normally all PhantomJS instances exit correctly for me, but if I include this they stop exiting. Which platform are you on?
Thanks for responding, Alex.
I'm on RHEL6.
@DelvarWorld - How about you?
CentOS 6(RHEL 6) here -- Same issue. But, I assumed it was because I haven't figured out how to add a timeout to the phantom object.
I see this, too: Phantom never dies. On OS X, using 1.8.1.
Also using 1.8.1 on osx
This line fixes phantom process not exiting for me
- Arch Linux Kernel 3.8.4
- PhantomJS 1.9.0
- Node.js 0.10.2
I think one need to wait for the kill event to be send. I resolved this by waiting a bit before exiting the script.
having the same problem on osx 10.7.5 phantomjs 1.9.0 Node 0.8.10
The instances are draining a lot of cpu as well from what I can see in
top -o cpu
Its the bridge.js that has started them from what I can see with
ps aux | grep phantom
The fix doesn't work for me. I think I get a script error in phantom that crashes phantom silently. The phantom-process is never killed
Whew, just spent hours wondering why I was spawning off phantomjs zombie processes. Fix works for me - I can't modify the node-phantom code so I'm working around it by using:
ph.exit();
ph._phantom.kill('SIGTERM');
shouldn't the right place to put this be line 141: ?
case 'phantomExited':
request(socket,[0,'exitAck']);
server.close();
io.set('client store expiration', 0);
cmds[cmdId].cb();
phantom.kill('SIGTERM');
delete cmds[cmdId];
break;