<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Hi Xialin,<br>
<br>
<div class="moz-cite-prefix">On 11/3/25 10:17 PM, Xialin Liu wrote:<br>
</div>
<blockquote type="cite" cite="mid:tencent_21FD93BB9048E2F3E238124538CEED097706@qq.com">
<p style="text-align: left; text-indent: 0px; margin: 0px 0px
1.25em; line-height: 1.43;"><span style="font-family: "Open
Sans", "Open Sans Fallback: Arial", sans-serif;
font-size: 16px; color: rgb(55, 65, 81);">Hi </span><span style="font-family: -apple-system, "system-ui",
system-ui, "PingFang SC", "Microsoft YaHei
UI", "Microsoft YaHei", "Source Han Sans
CN", "Noto Sans CJK SC", sans-serif; font-size:
14px; color: rgb(0, 0, 0); background-color: rgb(255, 255,
255);">Patricio</span></p>
<p style="text-align: left; text-indent: 0px; margin: 0px 0px
1.25em; line-height: 1.43;"><span style="font-family: "Open
Sans", "Open Sans Fallback: Arial", sans-serif;
font-size: 16px; color: rgb(55, 65, 81);">In our scenario, we
encountered a similar issue that appears to stem from the same
root cause. I’m happy to share the case details.</span></p>
<p style="text-align: left; text-indent: 0px; margin: 1.25em 0px;
line-height: 1.43;"><span style="font-family: "Open
Sans", "Open Sans Fallback: Arial", sans-serif;
font-size: 16px; color: rgb(55, 65, 81);">The problem arises
in our custom class loader: when we use Logback to log
messages, Logback attempts to acquire a lock during write
operations. Meanwhile, a virtual thread that’s in the process
of class initialization gets </span><span style="font-family:
"Open Sans", "Open Sans Fallback: Arial",
sans-serif; font-size: 16px; color: rgb(17, 24, 39);
font-weight: 600;">pinned</span><span style="font-family:
"Open Sans", "Open Sans Fallback: Arial",
sans-serif; font-size: 16px; color: rgb(55, 65, 81);"> to its
carrier thread. As a result, other virtual threads attempting
to use the same class end up being blocked with the message:<br>
</span><span style="font-family: ui-monospace, SFMono-Regular,
Menlo, Monaco, Consolas, "Liberation Mono",
"Courier New", monospace; font-size: 14px; color:
rgb(17, 24, 39); font-weight: 600;"><code style="font-family:
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
"Liberation Mono", "Courier New",
monospace;">"Waited for initialization of <class> by
other thread"</code></span><span style="font-family:
"Open Sans", "Open Sans Fallback: Arial",
sans-serif; font-size: 16px; color: rgb(55, 65, 81);">.</span></p>
<p style="text-align: left; text-indent: 0px; margin: 1.25em 0px;
line-height: 1.43;"><span style="font-family: "Open
Sans", "Open Sans Fallback: Arial", sans-serif;
font-size: 16px; color: rgb(55, 65, 81);">These waiting
threads also get pinned to their carrier threads — but
crucially, they </span><span style="font-family: "Open
Sans", "Open Sans Fallback: Arial", sans-serif;
font-size: 16px; color: rgb(17, 24, 39); font-weight: 600;">do
not enter</span><span style="font-family: "Open
Sans", "Open Sans Fallback: Arial", sans-serif;
font-size: 16px; color: rgb(55, 65, 81);"> </span><span style="font-family: ui-monospace, SFMono-Regular, Menlo,
Monaco, Consolas, "Liberation Mono", "Courier
New", monospace; font-size: 14px; color: rgb(17, 24, 39);
font-weight: 600;"><code style="font-family: ui-monospace,
SFMono-Regular, Menlo, Monaco, Consolas, "Liberation
Mono", "Courier New", monospace;"><clinit></code></span><span style="font-family: "Open Sans", "Open Sans
Fallback: Arial", sans-serif; font-size: 16px; color:
rgb(55, 65, 81);">. This creates a deadlock-like situation
where:</span></p>
<ul style="margin-block: 0px; padding-inline-start: 42px;
text-align: left; margin: 1.25em 0px; padding-left: 0px;
list-style-position: initial; list-style-type: disc;
line-height: 1.43;">
<li style="font-family: "Open Sans", "Open Sans
Fallback: Arial", sans-serif; font-size: 16px; color:
rgb(55, 65, 81); margin-top: 0.5em; margin-bottom: 0.5em;">One
ForkJoinPool (FJP) worker thread is trying to acquire
Logback’s lock.</li>
<li style="font-family: "Open Sans", "Open Sans
Fallback: Arial", sans-serif; font-size: 16px; color:
rgb(55, 65, 81); margin-top: 0.5em; margin-bottom: 0.5em;">Other
FJP workers are waiting on a non-existent <span style="color:
rgb(17, 24, 39); font-weight: 600;">ObjectMonitor</span> (likely
due to the pinned thread holding the monitor and not
progressing).</li>
</ul>
</blockquote>
Yes, this is the issue addressed in JDK-8369238 for the common
initialization paths. (Note that the initialization lock of a class
is implemented using an internal Java monitor, so this is probably
the one you are observing).<br>
<br>
<blockquote type="cite" cite="mid:tencent_21FD93BB9048E2F3E238124538CEED097706@qq.com">
<p style="text-align: left; text-indent: 0px; margin: 1.25em 0px;
line-height: 1.43;"><span style="font-family: "Open
Sans", "Open Sans Fallback: Arial", sans-serif;
font-size: 16px; color: rgb(55, 65, 81);">Interestingly, the
stack traces appear to be in normal Java code, which makes the
root cause non-obvious at first glance.</span></p>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;">"ForkJoinPool-1-worker-28"
#799 [828] daemon prio=5 os_prio=0 cpu=47855486.95ms
elapsed=258235.59s allocated=42813G defined_classes=287
tid=0x00007f4803ad9000 nid=828 waiting on condition
[0x00007fd88ee65000]</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;">
java.lang.Thread.State: WAITING (parking)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> Carrying
virtual thread #101393</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
jdk.internal.vm.Continuation.run(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/Continuation.java:252">java.base@21.0.3.0.6.1-redjdk/Continuation.java:252</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> - parking
to wait for <0x00007f4892f23810> (a
java.util.concurrent.locks.ReentrantLock$NonfairSync)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.lang.VirtualThread.runContinuation(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/VirtualThread.java:299">java.base@21.0.3.0.6.1-redjdk/VirtualThread.java:299</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.lang.VirtualThread$$Lambda/0x00007f484085cc48.run(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/Unknown">java.base@21.0.3.0.6.1-redjdk/Unknown</a>
Source)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ForkJoinTask.java:1403">java.base@21.0.3.0.6.1-redjdk/ForkJoinTask.java:1403</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.ForkJoinTask.doExec(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ForkJoinTask.java:387">java.base@21.0.3.0.6.1-redjdk/ForkJoinTask.java:387</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ForkJoinPool.java:1313">java.base@21.0.3.0.6.1-redjdk/ForkJoinPool.java:1313</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.ForkJoinPool.scan(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ForkJoinPool.java:1844">java.base@21.0.3.0.6.1-redjdk/ForkJoinPool.java:1844</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.ForkJoinPool.runWorker(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ForkJoinPool.java:1809">java.base@21.0.3.0.6.1-redjdk/ForkJoinPool.java:1809</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.ForkJoinWorkerThread.run(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ForkJoinWorkerThread.java:188">java.base@21.0.3.0.6.1-redjdk/ForkJoinWorkerThread.java:188</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;">
"engine-44-111" #101393 Mounted virtual thread on
"ForkJoinPool-1-worker-28" #799</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
jdk.internal.misc.Unsafe.park(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/Native">java.base@21.0.3.0.6.1-redjdk/Native</a>
Method)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> - parking
to wait for <0x00007fd984009f38> (a
java.util.concurrent.locks.ReentrantLock$NonfairSync)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.lang.VirtualThread.parkOnCarrierThread(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/VirtualThread.java:817">java.base@21.0.3.0.6.1-redjdk/VirtualThread.java:817</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.lang.VirtualThread.park(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/VirtualThread.java:755">java.base@21.0.3.0.6.1-redjdk/VirtualThread.java:755</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.lang.System$2.parkVirtualThread(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/System.java:2714">java.base@21.0.3.0.6.1-redjdk/System.java:2714</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.locks.LockSupport.park(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/LockSupport.java:221">java.base@21.0.3.0.6.1-redjdk/LockSupport.java:221</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/AbstractQueuedSynchronizer.java:754">java.base@21.0.3.0.6.1-redjdk/AbstractQueuedSynchronizer.java:754</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/AbstractQueuedSynchronizer.java:990">java.base@21.0.3.0.6.1-redjdk/AbstractQueuedSynchronizer.java:990</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.locks.ReentrantLock$Sync.lock(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ReentrantLock.java:153">java.base@21.0.3.0.6.1-redjdk/ReentrantLock.java:153</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.locks.ReentrantLock.lock(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ReentrantLock.java:322">java.base@21.0.3.0.6.1-redjdk/ReentrantLock.java:322</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.core.OutputStreamAppender.writeBytes(OutputStreamAppender.java:197)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:231)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.core.rolling.RollingFileAppender.subAppend(RollingFileAppender.java:235)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:102)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:84)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:270)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.classic.Logger.callAppenders(Logger.java:257)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
ch.qos.logback.classic.Logger.info(Logger.java:591)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at <span style="background-color: rgb(255, 255, 255);">com.example.loader.</span>PluginClassLoader.reverseLoadClassInternal(PluginClassLoader.java:217)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at <span style="background-color: rgb(255, 255, 255);">com.example.loader.</span>PluginClassLoader.loadClass(PluginClassLoader.java:132)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> - locked
<0x00007fd9b83dabc0> (a
com.example.loader.SharedPluginClassLoader)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.lang.ClassLoader.loadClass(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ClassLoader.java:526">java.base@21.0.3.0.6.1-redjdk/ClassLoader.java:526</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
com.example.MyExample.init(<span style="background-color:
rgb(255, 255, 255);">MyExample</span>.java:34)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
com.example.TaskHelper$$Lambda/0x00007f484149dec0.run(Unknown
Source)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.ThreadPoolExecutor.runWorker(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ThreadPoolExecutor.java:1144">java.base@21.0.3.0.6.1-redjdk/ThreadPoolExecutor.java:1144</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.util.concurrent.ThreadPoolExecutor$Worker.run(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/ThreadPoolExecutor.java:642">java.base@21.0.3.0.6.1-redjdk/ThreadPoolExecutor.java:642</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.lang.Thread.runWith(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/Thread.java:1607">java.base@21.0.3.0.6.1-redjdk/Thread.java:1607</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.lang.VirtualThread.run(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/VirtualThread.java:462">java.base@21.0.3.0.6.1-redjdk/VirtualThread.java:462</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
java.lang.VirtualThread$VThreadContinuation$1.run(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/VirtualThread.java:254">java.base@21.0.3.0.6.1-redjdk/VirtualThread.java:254</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
jdk.internal.vm.Continuation.enter0(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/Continuation.java:326">java.base@21.0.3.0.6.1-redjdk/Continuation.java:326</a>)</div>
<div style="font-family: -apple-system, system-ui; font-size:
14px; color: rgb(0, 0, 0); line-height: 1.43;"> at
jdk.internal.vm.Continuation.enter(<a class="moz-txt-link-abbreviated" href="mailto:java.base@21.0.3.0.6.1-redjdk/Continuation.java:317">java.base@21.0.3.0.6.1-redjdk/Continuation.java:317</a>)</div>
</blockquote>
I’m confused about this stacktrace because I don’t see the
<clinit> on the stack. If you could send the stacktraces of
all threads, including the native stacks, that would be helpful. <br>
<br>
Thanks,<br>
Patricio<br>
</body>
</html>