Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8213397

Stack dump should show more clearly when a thread is blocked on a class initialization monitor

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 12
    • Fix Version/s: 13
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b04

      Description

      If a thread tries to access a class for which static initialization is still in progress, it will block on the VM internal "class initialization monitor". When this happens the stack trace for the thread is quite cryptic e.g.

      "pool-1-thread-1" #14 prio=5 os_prio=0 tid=0x0000000024925800 nid=0x449c in Object.wait() [0x00000000251be000]
         java.lang.Thread.State: RUNNABLE
              at Main$$Lambda$1/26117480.call(Unknown Source)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
              at java.lang.Thread.run(Thread.java:748)

      We can see the thread is blocked in Object.wait() but the first Java frame does not contain code that has an explicit Object.wait in it. So this is quite puzzling to the user.

      We should augment the output somehow to show that it is in fact blocked on a class initialization monitor.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dholmes David Holmes
              Reporter:
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: