18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Browser not killed - Race condition?
When starting a TestSuite in multithreaded mode we seem to encounter a race condition:
10.11.2010 15:00:30 net.sf.sahi.test.ProcessHelper kill
INFO: Kill: null
java.lang.NullPointerException
at net.sf.sahi.test.ProcessHelper.killPIDs(ProcessHelper.java:172)
at net.sf.sahi.test.ProcessHelper.kill(ProcessHelper.java:165)
at net.sf.sahi.test.BrowserLauncher.kill(BrowserLauncher.java:80)
at net.sf.sahi.test.TestLauncher.kill(TestLauncher.java:122)
at net.sf.sahi.test.SahiTestSuite.notifyComplete2(SahiTestSuite.java:175)
at net.sf.sahi.test.SahiTestSuite.notifyComplete(SahiTestSuite.java:164)
at net.sf.sahi.rhino.RhinoScriptRunner.stop(RhinoScriptRunner.java:211)
at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:132)
at java.lang.Thread.run(Unknown Source)
10.11.2010 15:00:32 net.sf.sahi.test.ProcessHelper$PIDGatherer run
INFO: PIDs: [3540]; 3282 ms
PID 3540 is never killed.
Modifying ProcessLauncher.kill as follows solved our problem:
public void kill() {
try {
lock.acquire();
if (pids == null) {
logger.warning("PIDs unset, no PIDs to kill. " + this.toString());
return;
}
logger.info("Kill: " + pids + " " + this.toString());
for (int i = 0; i < 4; i++) {
killPIDs();
if (waitTillPIDsGone(pids, 3000))
return;
}
} catch (InterruptedException e1) {
e1.printStackTrace();
} finally {
lock.release();
}
}
10.11.2010 15:00:30 net.sf.sahi.test.ProcessHelper kill
INFO: Kill: null
java.lang.NullPointerException
at net.sf.sahi.test.ProcessHelper.killPIDs(ProcessHelper.java:172)
at net.sf.sahi.test.ProcessHelper.kill(ProcessHelper.java:165)
at net.sf.sahi.test.BrowserLauncher.kill(BrowserLauncher.java:80)
at net.sf.sahi.test.TestLauncher.kill(TestLauncher.java:122)
at net.sf.sahi.test.SahiTestSuite.notifyComplete2(SahiTestSuite.java:175)
at net.sf.sahi.test.SahiTestSuite.notifyComplete(SahiTestSuite.java:164)
at net.sf.sahi.rhino.RhinoScriptRunner.stop(RhinoScriptRunner.java:211)
at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:132)
at java.lang.Thread.run(Unknown Source)
10.11.2010 15:00:32 net.sf.sahi.test.ProcessHelper$PIDGatherer run
INFO: PIDs: [3540]; 3282 ms
PID 3540 is never killed.
Modifying ProcessLauncher.kill as follows solved our problem:
public void kill() {
try {
lock.acquire();
if (pids == null) {
logger.warning("PIDs unset, no PIDs to kill. " + this.toString());
return;
}
logger.info("Kill: " + pids + " " + this.toString());
for (int i = 0; i < 4; i++) {
killPIDs();
if (waitTillPIDsGone(pids, 3000))
return;
}
} catch (InterruptedException e1) {
e1.printStackTrace();
} finally {
lock.release();
}
}
Comments
Thanks for the update. This looks right on first glance. We will look deeper into it and if fine, add it to the codebase.
Thanks again,
Narayan