RFR: 8337199: Add jcmd Thread.vthread_summary diagnostic command

Larry Cable duke at openjdk.org
Mon Nov 25 17:56:16 UTC 2024


On Thu, 14 Nov 2024 21:34:08 GMT, Larry Cable <duke at openjdk.org> wrote:

> c.f: [https://bugs.openjdk.org/browse/JDK-8339420](https://bugs.openjdk.org/browse/JDK-8339420)
> 
> Summary
> -------
> 
> Add `jcmd <pid> Thread.vthread_summary` to print summary information that is useful when trying to diagnose issues with virtual threads.
> 
> 
> Problem
> -------
> 
> The JDK is lacking tooling to diagnose issues with virtual threads.
> 
> 
> Solution
> --------
> 
> Add a new command that the `jcmd` command line tool can use to print information about virtual threads. The output includes the virtual thread scheduler, the schedulers used to support timeouts, and the I/O pollers used to support virtual threads doing socket I/O, and a summary of the thread groupings.
> 
> Here is sample output. The output is intended for experts and is not intended for automated parsing.
> 
> 
> Virtual thread scheduler:
> java.util.concurrent.ForkJoinPool at 4a624db0[Running, parallelism = 16, size = 2, active = 0, running = 0, steals = 2, tasks = 0, submissions = 0]
> 
> Timeout schedulers:
> [0] java.util.concurrent.ScheduledThreadPoolExecutor at 1f17ae12[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
> [1] java.util.concurrent.ScheduledThreadPoolExecutor at 6193b845[Running, pool size = 1, active threads = 0, queued tasks = 1, completed tasks = 0]
> [2] java.util.concurrent.ScheduledThreadPoolExecutor at c4437c4[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
> [3] java.util.concurrent.ScheduledThreadPoolExecutor at 3f91beef[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]
> 
> Read I/O pollers:
> [0] sun.nio.ch.KQueuePoller at 524bf25 [registered = 1]
> 
> Write I/O pollers:
> [0] sun.nio.ch.KQueuePoller at 25c41da2 [registered = 0]
> 
> Thread groupings:
> <root> [platform threads = 11, virtual threads = 0]
> java.util.concurrent.ScheduledThreadPoolExecutor at c4437c4 [platform threads = 0, virtual threads = 0]
> java.util.concurrent.ScheduledThreadPoolExecutor at 3f91beef [platform threads = 0, virtual threads = 0]
> ForkJoinPool.commonPool/jdk.internal.vm.SharedThreadContainer at 4fa374ea [platform threads = 0, virtual threads = 0]
> java.util.concurrent.ThreadPoolExecutor at 506e1b77 [platform threads = 1, virtual threads = 0]
> java.util.concurrent.ScheduledThreadPoolExecutor at 1f17ae12 [platform threads = 0, virtual threads = 0]
> java.util.concurrent.ThreadPerTaskExecutor at 24155ffc [platform threads = 0, virtual threads = 2]
> ForkJoinPool-1/jdk.internal.vm.SharedThreadContainer at 48a03463 [platform threads = 2, virtual threads = 0]
> java.util.concurrent.Scheduled...

ok

On 11/25/24 8:50 AM, Alan Bateman wrote:
>
> In the CSR I think we've agreed to drop the thread groupings from this 
> command. Can you update the Solution section so the sample output 
> aligns with that?
>
> The PR shows merge conflicts, can you sync up the branch to closer to 
> main line? The man page update moves from jcmd.1 to jcmd.md. Drop 
> "thread groupings" from the description, and also 
> VThreadSummaryDCmd::description (diagnosticCommand.hpp).
>
> I see the commit to comment out printing the thread groupings but I 
> think better to remove the unused code. You can grab the latest 
> VThreadSummary.java and VThreadSummaryTest.java from the loom repo. 
> Also can you grab Poller.java too as it has the correct merge with JEP 
> 491.
>
>> Reply to this email directly, view it on GitHub 
> <https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/22121*issuecomment-2498536459__;Iw!!ACWV5N9M2RV99hQ!JjPtvmHtMJvorfhhN34WXQwd5s4Dfp1nV0vfAizdAFkCIr7fneoIgYFNyK5oKvkoNygpkMv8yeJiPHBbx7pBSB4glQ$>, 
> or unsubscribe 
> <https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ANTA67SBYHIVRB7FN6EIPVD2CNINBAVCNFSM6AAAAABRZ3DKS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJYGUZTMNBVHE__;!!ACWV5N9M2RV99hQ!JjPtvmHtMJvorfhhN34WXQwd5s4Dfp1nV0vfAizdAFkCIr7fneoIgYFNyK5oKvkoNygpkMv8yeJiPHBbx7qqQGP0tg$>.
> You are receiving this because you were mentioned.Message ID: 
> ***@***.***>
>

--------------43A07On2mpTNaH2Wy6LHFItz
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    ok<br>
    <br>
    <div class="moz-cite-prefix">On 11/25/24 8:50 AM, Alan Bateman
      wrote:<br>
    </div>
    <blockquote type="cite" ***@***.***">
      
      <p dir="auto">In the CSR I think we've agreed to drop the thread
        groupings from this command. Can you update the Solution section
        so the sample output aligns with that?</p>
      <p dir="auto">The PR shows merge conflicts, can you sync up the
        branch to closer to main line? The man page update moves from
        jcmd.1 to jcmd.md. Drop "thread groupings" from the description,
        and also VThreadSummaryDCmd::description
        (diagnosticCommand.hpp).</p>
      <p dir="auto">I see the commit to comment out printing the thread
        groupings but I think better to remove the unused code. You can
        grab the latest VThreadSummary.java and VThreadSummaryTest.java
        from the loom repo. Also can you grab Poller.java too as it has
        the correct merge with JEP 491.</p>
      <p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>
        Reply to this email directly, <a href="https://urldefense.com/v3/__https://github.com/openjdk/jdk/pull/22121*issuecomment-2498536459__;Iw!!ACWV5N9M2RV99hQ!JjPtvmHtMJvorfhhN34WXQwd5s4Dfp1nV0vfAizdAFkCIr7fneoIgYFNyK5oKvkoNygpkMv8yeJiPHBbx7pBSB4glQ$" moz-do-not-send="true">view it on GitHub</a>, or <a href="https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/ANTA67SBYHIVRB7FN6EIPVD2CNINBAVCNFSM6AAAAABRZ3DKS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIOJYGUZTMNBVHE__;!!ACWV5N9M2RV99hQ!JjPtvmHtMJvorfhhN34WXQwd5s4Dfp1nV0vfAizdAFkCIr7fneoIgYFNyK5oKvkoNygpkMv8yeJiPHBbx7qqQGP0tg$" moz-do-not-send="true">unsubscribe</a>.<br>
        You are receiving this because you were mentioned.<img src="https://github.com/notifications/beacon/ANTA67SHNLF7ZLZXXI2FCHT2CNINBA5CNFSM6AAAAABRZ3DKS2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUU5SSAW.gif" alt="" moz-do-not-send="true" width="1" height="1"><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message
          ID: <span><openjdk/jdk/pull/22121/c2498536459</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
      <script type="application/ld+json">[
{
***@***.***": "http://schema.org",
***@***.***": "EmailMessage",
"potentialAction": {
***@***.***": "ViewAction",
"target": "https://github.com/openjdk/jdk/pull/22121#issuecomment-2498536459",
"url": "https://github.com/openjdk/jdk/pull/22121#issuecomment-2498536459",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
***@***.***": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>
    </blockquote>
    <br>
  </body>
</html>

--------------43A07On2mpTNaH2Wy6LHFItz--

-------------

PR Comment: https://git.openjdk.org/jdk/pull/22121#issuecomment-2498677452


More information about the core-libs-dev mailing list