Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

PhantomJS.quit() does not kill spawned phantomjs process #5921

Closed
lukeis opened this issue Mar 4, 2016 · 8 comments
Closed

PhantomJS.quit() does not kill spawned phantomjs process #5921

lukeis opened this issue Mar 4, 2016 · 8 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 5921

Before filing an issue, please read the page at
http://code.google.com/p/selenium/wiki/SeleniumHelp This contains lot of
information about how best to get help, and tells you what we need to know.

Still here? We know that bugs are frustrating and annoying things. We also
know that you've probably spent ages trying to figure out what's wrong. The
more information you give us now, the more likely it is that we'll be able
to help.

What steps will reproduce the problem?
> pgrep phantomjs
> wd = webdriver.PhantomJS()
> wd.get('http://google.com')
> wd.quit()
> pgrep phantomjs
987

What is the expected output? What do you see instead?

The expected output is that when using webdriver multiple times, phantomjs processes
do not accumulate. Instead, the more times you use PhantomJS, the more dangling phantomjs
processes there are.

Selenium version: 2.33.0
OS: Ubuntu 12.04
Browser: PhantomJS
Browser version: 1.9.1

Please provide any additional information below. A sample reduced test
case, or a public URL that demonstrates the problem will intrigue our merry
band of Open Source developers far more than nothing at all: they'll be far
more likely to look at your problem if you make it easy for them!

I was able to fix this by replacing self.process.kill() in webdriver/phantomjs/service.py
with self.process.send_signal(signal.SIGTERM). If you look at the source of the /usr/local/bin/phantomjs,
it only kills the spawned phantomjs process if it recieves a SIGTERM.

Reported by michael.j.stringer on 2013-07-13 00:06:13

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by a.u.savchuk on 2013-08-05 15:17:35

  • Labels added: Browser-PhantomJS, Lang-Python

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Created a patch based on the suggested solution.

This solved the problem for me.

Reported by treyhunner on 2013-08-16 06:42:09


- _Attachment: [0001-Fix-PhantomJS-process-termination-fixes-mem-leak.patch](https://storage.googleapis.com/google-code-attachments/selenium/issue-5921/comment-2/0001-Fix-PhantomJS-process-termination-fixes-mem-leak.patch)_

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2013-10-23 20:57:35

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I just crashed my computer after filling my 16GB of RAM with runaway PhantomJS processes
because I forgot to apply the patch after switching computers.

Anything I can do to help get this merged more quickly?

Reported by treyhunner on 2013-10-28 22:26:44

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

can you confirm you've signed the cla?
http://goo.gl/qC50R

Reported by luke.semerau on 2013-10-28 22:32:43

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Yes I have signed the CLA.

Reported by treyhunner on 2013-10-29 00:43:23

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

This issue was closed by revision 885b62bbb7ee.

Reported by luke.semerau on 2013-11-07 04:01:30

  • Status changed: Fixed

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:17:34

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant