-
Enhancement
-
Resolution: Fixed
-
P4
-
11, 12
-
b04
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.
"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.
- relates to
-
JDK-8217337 [TESTBUG] TestThreadDumpClassInitMonitor.java fails with Unexpected thread info line
- Resolved
-
JDK-8213361 Application hangs when lambda task submitted to executor from <clinit>
- Closed