RFR: 8330846: Add stacks of mounted virtual threads to the HotSpot thread dump
David Holmes
dholmes at openjdk.org
Mon Jun 3 08:37:03 UTC 2024
On Fri, 31 May 2024 02:07:25 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Print the stack traces of mounted virtual threads when calling `jcmd <pid> Thread.print`.
>
> I'd probably give preference to the stack of the virtual thread, as the stack of the carrier when a vthread is mounted is generally quite uninteresting:
>
> "ForkJoinPool-1-worker-1" #25 [33795] daemon prio=5 os_prio=31 cpu=46574.42ms elapsed=47.15s tid=0x00007f81670d1a00 [0x000070000e9a4000]
> Carrying virtual thread #24
> at Main.lambda$main$0(Main.java:7)
> at java.lang.VirtualThread.run(java.base/VirtualThread.java:381)
> at jdk.internal.vm.Continuation.run(java.base/Continuation.java:262)
> at java.lang.VirtualThread.runContinuation(java.base/VirtualThread.java:283)
> at java.lang.VirtualThread$$Lambda/0x00000001220b2868.run(java.base/Unknown Source)
> at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(java.base/ForkJoinTask.java:1726)
> at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(java.base/ForkJoinTask.java:1717)
> at java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(java.base/ForkJoinTask.java:1641)
> at java.util.concurrent.ForkJoinTask.doExec(java.base/ForkJoinTask.java:507)
> at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(java.base/ForkJoinPool.java:1455)
> at java.util.concurrent.ForkJoinPool.runWorker(java.base/ForkJoinPool.java:2031)
> at java.util.concurrent.ForkJoinWorkerThread.run(java.base/ForkJoinWorkerThread.java:189)
> > * The format proposed by @dholmes-ora definitely makes sense
>
> You will different get different opinions on how it is presented. Can you also try putting a new section that lists the mounted virtual threads and their stack trace. If the virtual thread has a name then it can be shown too.
That suggests to me that we have to iterate the list of all threads twice ?? If so that seems not ideal.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19482#issuecomment-2144602366
More information about the serviceability-dev
mailing list