When jtreg timeout handler throws exception (due to internal bug, for example), the timeout is not handled at all for the test and if the test is not going to terminate, jtreg can hang forever.
Example code:
public class ExceptionInTimeoutHandler extends com.sun.javatest.regtest.TimeoutHandler {
public ExceptionInTimeoutHandler(PrintWriter jtregLog, File outputDir, File testJdk) {
super(jtregLog, outputDir, testJdk);
}
@Override
protected void runActions(Process process, long pid) throws InterruptedException {
throw RuntimeException("will jtreg terminate?");
}
}
public class Livelock {
public static void main(String[] args) {
for ( ;; ) {
try { Thread.sleep(1000); } catch (Throwable t) {}
}
}
}
$ .../jtreg -thd:<handler-class-dir> -th:ExceptionInTimeoutHandler <test-dir>/Livelock.java
Example code:
public class ExceptionInTimeoutHandler extends com.sun.javatest.regtest.TimeoutHandler {
public ExceptionInTimeoutHandler(PrintWriter jtregLog, File outputDir, File testJdk) {
super(jtregLog, outputDir, testJdk);
}
@Override
protected void runActions(Process process, long pid) throws InterruptedException {
throw RuntimeException("will jtreg terminate?");
}
}
public class Livelock {
public static void main(String[] args) {
for ( ;; ) {
try { Thread.sleep(1000); } catch (Throwable t) {}
}
}
}
$ .../jtreg -thd:<handler-class-dir> -th:ExceptionInTimeoutHandler <test-dir>/Livelock.java
- relates to
-
CODETOOLS-7001525 Provide hook to execute something on test timeout
-
- Resolved
-