Issue Details (XML | Word | Printable)

Key: SRC-134
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Dan Fabulich
Reporter: Dan Fabulich
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Selenium Remote Control

Intermittent failure to kill Firefox on Linux

Created: 13/Oct/06 11:02 AM   Updated: 18/Nov/08 11:52 AM   Resolved: 13/Oct/06 02:02 PM
Component/s: Server
Affects Version/s: 0.9.0
Fix Version/s: 0.9.0

Environment: Our official Linux build VM


 Description  « Hide

Sorting through my e-mail, I find 18 build failures since Aug 29 up until Oct 13 that looked something like this:

Test: testChrome
Class: org.openqa.selenium.ServerTestSuite
java.lang.IllegalThreadStateException: process hasn't exited
at java.lang.UNIXProcess.exitValue(UNIXProcess.java:172)
at org.openqa.selenium.server.browserlaunchers.AsyncExecute.waitForProcessDeath(AsyncExecute.java:108)
at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLauncher.close(FirefoxChromeLauncher.java:188)
at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLLauncher.java:51)
at org.openqa.selenium.server.HTMLRunnerTestBase.runHTMLSuite(HTMLRunnerTestBase.java:58)
at org.openqa.selenium.server.LinuxHTMLRunnerTest.testChrome(LinuxHTMLRunnerTest.java:14)

That ain't good, because the call to waitForProcessDeath comes immediately after a call to process.destroy()! This seems to only happen on Linux, and apparently only with Firefox.

It's not obvious what we can do about this, other than adding in a facility to support killing the process more directly using "kill -9". The trouble with that is that we don't know the PID of the process in question, and "ps" syntax can vary a great deal from Unix-to-Unix. (We have a similar facility available on Windows, though we have it disabled right now because it wasn't reliable across various versions of Windows.)



Sort Order: Ascending order - Click to sort in descending order
Dan Fabulich added a comment - 13/Oct/06 11:17 AM

Actually, there's some great tips about PID management here in this bug re: System.getPID:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4244896

The most interesting tips:

1) UnixProcess contains a private member variable that contains the pid; you just need to modify its accessibility.
2) You can use this trick to get the PID: ManagementFactory.getRuntimeMXBean().getName()

(though there's often other stuff in the runtime MX bean name, including the hostname, that you'll need to strip out)


Dan Fabulich added a comment - 13/Oct/06 02:02 PM

Possible fix in revision 1498. Now we try to "kill -9" the process if it remains alive for too long. No way of knowing if this will "really" fix the problem (we just have to wait a while and hope it goes away), but I feel pretty good about it.