Here's an example of a deadlock cycle with with one platform Thread and one virtual Thread.
Found one Java-level deadlock:
=============================
"Thread-0":
waiting to lock monitor 0x00007fe381c5ca60 (object 0x000000070fbf1e50, a java.lang.Object),
which is held by "ForkJoinPool-1-worker-1"
"ForkJoinPool-1-worker-1":
waiting to lock monitor 0x00007fe381c5cb30 (object 0x000000070fbf1e40, a java.lang.Object),
which is held by "Thread-0"
Java stack information for the threads listed above:
===================================================
"Thread-0":
at Deadlock.lambda$test$0(Deadlock.java:32)
- waiting to lock <0x000000070fbf1e50> (a java.lang.Object)
- locked <0x000000070fbf1e40> (a java.lang.Object)
at Deadlock$$Lambda$26/0x00000008000849f0.run(Unknown Source)
at java.lang.Thread.run(java.base/Thread.java:1555)
"ForkJoinPool-1-worker-1":
at jdk.internal.vm.Continuation.run(java.base/Continuation.java:259)
at java.lang.VirtualThread.runContinuation(java.base/VirtualThread.java:213)
at java.lang.VirtualThread$$Lambda$35/0x00000008000e7da8.run(java.base/Unknown Source)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(java.base/ForkJoinTask.java:1421)
at java.util.concurrent.ForkJoinTask.doExec(java.base/ForkJoinTask.java:385)
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(java.base/ForkJoinPool.java:1311)
at java.util.concurrent.ForkJoinPool.scan(java.base/ForkJoinPool.java:1840)
at java.util.concurrent.ForkJoinPool.runWorker(java.base/ForkJoinPool.java:1806)
at java.util.concurrent.ForkJoinWorkerThread.run(java.base/ForkJoinWorkerThread.java:183)
Found 1 deadlock.
Found one Java-level deadlock:
=============================
"Thread-0":
waiting to lock monitor 0x00007fe381c5ca60 (object 0x000000070fbf1e50, a java.lang.Object),
which is held by "ForkJoinPool-1-worker-1"
"ForkJoinPool-1-worker-1":
waiting to lock monitor 0x00007fe381c5cb30 (object 0x000000070fbf1e40, a java.lang.Object),
which is held by "Thread-0"
Java stack information for the threads listed above:
===================================================
"Thread-0":
at Deadlock.lambda$test$0(Deadlock.java:32)
- waiting to lock <0x000000070fbf1e50> (a java.lang.Object)
- locked <0x000000070fbf1e40> (a java.lang.Object)
at Deadlock$$Lambda$26/0x00000008000849f0.run(Unknown Source)
at java.lang.Thread.run(java.base/Thread.java:1555)
"ForkJoinPool-1-worker-1":
at jdk.internal.vm.Continuation.run(java.base/Continuation.java:259)
at java.lang.VirtualThread.runContinuation(java.base/VirtualThread.java:213)
at java.lang.VirtualThread$$Lambda$35/0x00000008000e7da8.run(java.base/Unknown Source)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(java.base/ForkJoinTask.java:1421)
at java.util.concurrent.ForkJoinTask.doExec(java.base/ForkJoinTask.java:385)
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(java.base/ForkJoinPool.java:1311)
at java.util.concurrent.ForkJoinPool.scan(java.base/ForkJoinPool.java:1840)
at java.util.concurrent.ForkJoinPool.runWorker(java.base/ForkJoinPool.java:1806)
at java.util.concurrent.ForkJoinWorkerThread.run(java.base/ForkJoinWorkerThread.java:183)
Found 1 deadlock.
- links to
-
Commit openjdk/loom/69fba4ff