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

Unchecked exception thrown from non-main thread can hang jtreg test

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P3 P3
    • None
    • None
    • tools
    • None
    • generic
    • generic

      Any thread that throws an unchecked exception followed by another thread starting a thread ( or invoking any operation on the group requiring its monitor ) will encounter a hang. When run in samevm or agentvm mode.

      See discussion on the openjdk core-libs-dev mailing list:
        http://mail.openjdk.java.net/pipermail/core-libs-dev/2011-October/007885.html

      Minimal jtreg test to reproduce this:

      /*
       * @test
       */
      import java.util.concurrent.Phaser;

      public class HangJtreg {
          static Phaser phaser = new Phaser(2);

          public static void main(String[] args) throws Exception {
              (new Thread(new Runnable() {
                  public void run() {
                      try {
                          throw new RuntimeException("thrown from ThrowingThread");
                      } finally {
                          phaser.arrive();
                      }
                  }
              })).start();

              phaser.arriveAndAwaitAdvance();
              (new Thread()).start();
          }
      }

            Unassigned Unassigned
            chegar Chris Hegarty
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: