Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7901682

jtreg hangs when secondary thread throws

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • None
    • tools
    • None

      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");
              t.start();
              t.join();
          }
      }

      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@9-ea/Native Method)
      - waiting on <0x00000006d5613070> (a java.lang.Thread)
      at java.lang.Thread.join(java.base@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
      com.sun.javatest.regtest.agent.MainActionHelper$SameVMThreadGroup)
      at java.lang.Thread.dispatchUncaughtException(java.base@9-ea/Thread.java:2016)

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

            cstein Christian Stein
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: