RFR: 7903217: jtreg could try killing descendants of stuck test, before timing out the test
Jonathan Gibbons
jjg at openjdk.org
Thu Aug 11 20:46:18 UTC 2022
On Thu, 28 Jul 2022 18:58:41 GMT, Gerard Ziemski <gziemski at openjdk.org> wrote:
> This is an enhancement that aims to improve the robustness of the testing by attempting to quit any child processes (that are possibly stuck and are blocking the parent process from terminating) before timing out the target parent process.
>
> Aborting a process will flush its stdout/stderr streams, which will hopefully get captured in the test's log and provide additional clues as to why a test was timing out.
>
> This enhancement was locally tested with a handcrafted test that itself launched a child process that would get stuck on purpose and worked as intended.
>
> Hopefully, this will help debug issues such as [JDK-8286345](https://bugs.openjdk.org/browse/JDK-8286345)
src/share/classes/com/sun/javatest/regtest/exec/ProcessCommand.java line 267:
> 265: long count = descendants.count();
> 266: if (count > 0) {
> 267: System.err.println("Detected a possibly stuck process (pid:"+pid+") with "+count+" descendants");
Don't use `System.err` directly; use the `err` and `out` streams that were passed in when the class was invoked.
src/share/classes/com/sun/javatest/regtest/exec/ProcessCommand.java line 307:
> 305: alarm.cancel();
> 306:
> 307: return getStatus(exitCode, statusScanner.exitStatus());
I think you need to do something more here. If the class killed child processes, you need to ensure that (probably) `Status.error` is returned with a suitable string. In other words, consider the case where you unlock a child process and the main process exits normally for some reason. That should *not* be grounds for the test to pass.
-------------
PR: https://git.openjdk.org/jtreg/pull/97
More information about the jtreg-dev
mailing list