jtreg hangs when secondary thread throws

Martin Buchholz martinrb at google.com
Tue May 17 06:28:33 UTC 2016

Here's a minimal test with a throwing non-main thread:

/* @test */
public class YY {
    public static void main(String[] args) throws Exception {
        Thread t = new Thread(() -> { throw new Error(); }, "justDie");

If I run this with jtreg 4.2-b02 + jdk9+118, I get a mysterious timeout.

Checking the stacks during the hang, I see no trace of YY.main (it was
interrupted early), but I do see:

"justDie" #14 prio=5 os_prio=0 tid=0x00007fb7b0001800 nid=0x230b in
Object.wait() [0x00007fb7f1d9f000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
at java.lang.Object.wait(java.base at 9-ea/Native Method)
- waiting on <0x00000006d5613070> (a java.lang.Thread)
at java.lang.Thread.join(java.base at 9-ea/Thread.java:1321)
- waiting to re-lock in wait() <0x00000006d5613070> (a java.lang.Thread)
at com.sun.javatest.regtest.agent.MainActionHelper$SameVMThreadGroup.cleanup(MainActionHelper.java:306)
at com.sun.javatest.regtest.agent.MainActionHelper$SameVMThreadGroup.uncaughtException(MainActionHelper.java:273)
- locked <0x00000006d5626308> (a
at java.lang.Thread.dispatchUncaughtException(java.base at 9-ea/Thread.java:2016)

so something's gone wrong with the uncaught exception handling.

More information about the jtreg-use mailing list