Summary
Add jcmd <pid> Thread.vthread_scheduler
to print the virtual thread scheduler.
Add jcmd <pid> Thread.vthread_pollers
to print the I/O pollers that support virtual threads doing blocking network I/O operations.
Problem
The JDK is lacking tooling to diagnose issues with virtual threads.
Solution
Here is sample output from jcmd <pid> Thread.vthread_scheduler
:
28569:
java.util.concurrent.ForkJoinPool@69a75ffc[Running, parallelism = 16, size = 1, active = 0, running = 0, steals = 3, tasks = 0, submissions = 0]
Delayed task schedulers:
[0] java.util.concurrent.ScheduledThreadPoolExecutor@219727f4[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
[1] java.util.concurrent.ScheduledThreadPoolExecutor@71602cb5[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
[2] java.util.concurrent.ScheduledThreadPoolExecutor@3242d43a[Running, pool size = 1, active threads = 0, queued tasks = 0, completed tasks = 1]
[3] java.util.concurrent.ScheduledThreadPoolExecutor@52dd1f98[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
Here is sample output from jcmd <pid> Thread.vthread_pollers
:
28569:
Master I/O poller:
sun.nio.ch.KQueuePoller@6c15742d [registered = 5, owner = Thread[#35,MasterPoller,5,InnocuousThreadGroup]]
Read I/O pollers:
[0] sun.nio.ch.KQueuePoller@5bf17d3 [registered = 0, owner = VirtualThread[#36,SubPoller-0]/waiting]
[1] sun.nio.ch.KQueuePoller@65ad3992 [registered = 0, owner = VirtualThread[#38,SubPoller-1]/waiting]
[2] sun.nio.ch.KQueuePoller@2e8b5a3d [registered = 0, owner = VirtualThread[#39,SubPoller-2]/waiting]
[3] sun.nio.ch.KQueuePoller@3e2d1889 [registered = 0, owner = VirtualThread[#40,SubPoller-3]/waiting]
Write I/O pollers:
[0] sun.nio.ch.KQueuePoller@4f3c4151 [registered = 0, owner = VirtualThread[#44,SubPoller-4]/waiting]
The output is intended for experts (support/sustaining engineers) and is not intended for automated parsing. The actual output varies by configuration, and in the case of the I/O pollers, by operating system.
Future work on jcmd
may provide an option to return a JSON object.
Specification
The jcmd
man page is updated to add Thread.vthread_scheduler
with the following description:
Print the virtual thread scheduler, and the delayed task schedulers that support virtual threads doing timed operations.
Impact: Low
and the Thread.vthread_pollers
with the following description:
Print the I/O pollers that support virtual threads doing blocking network I/O operations.
Impact: Low
- csr of
-
JDK-8337199 Add jcmd Thread.vthread_scheduler and Thread.vthread_pollers diagnostic commands
- Resolved