-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8337199: Add jcmd Thread.vthread_summary diagnostic command #22121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back larry-cable! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
|
@larry-cable this pull request can not be integrated into git checkout JDK-8337199
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push |
|
@larry-cable The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
…and disabled asssociated tests
|
In the CSR I think we've agreed to drop the thread groupings from this command. Can you update the Solution sectioning this PR 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. |
|
/label remove security |
|
@AlanBateman |
|
@AlanBateman |
|
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": "#22121 (comment)",
"url": "#22121 (comment)",
"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--
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks like a good addition. We need to finalize names and content as per CSR request. A few coding/style issues that I've flagged.
Thanks.
| Klass* k = SystemDictionary::resolve_or_fail(sym, true, CHECK); | ||
| if (HAS_PENDING_EXCEPTION) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can never reach line 1124 if there is a pending exception because the CHECK macro will do a return from the method. I see the same problem pre-exists in the other DCmd code. If you want to handle exceptions directly then you want to use THREAD not CHECK.
| // check that result is byte array | ||
| oop res = cast_to_oop(result.get_jobject()); | ||
| assert(res->is_typeArray(), "just checking"); | ||
| assert(TypeArrayKlass::cast(res->klass())->element_type() == T_BYTE, "just checking"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just called this out in another PR. These assertions are completely unnecessary unless you are trying to check the basic JavaCall operation - which you should not be. You are calling a method that returns a byte[] and that is what you will get back.
| static const char* name() { return "Thread.print"; } | ||
| static const char* description() { | ||
| return "Print all threads with stacktraces."; | ||
| return "Print all platform threads with stacktraces."; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best not hide this correction in this PR but file a separate issue for it.
| sb.append("Virtual thread scheduler:") | ||
| .append(System.lineSeparator()); | ||
| sb.append(JLA.virtualThreadDefaultScheduler()) | ||
| .append(System.lineSeparator()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stylistically it is common/customary to align the dot operator in chained method calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was done this way in the loom repo because the first string is the heading, the strings that follow go under the heading. Also you'll find the IDE will just indent these anyway.
| sb.append("Virtual thread scheduler:") | ||
| .append(System.lineSeparator()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you just do:
sb.append("Virtual thread scheduler:\n")
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I was thinking about %n but you can't use that here.
| .append(System.lineSeparator()); | ||
| sb.append(System.lineSeparator()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this style trying to draw attention to the blank lines between sections? It looks odd to me to not chain the final append as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a blank line, shouldn't be chained to the previous statement.
| @Override | ||
| public String toString() { | ||
| return Objects.toIdentityString(this) + " [registered = " + map.size() + "]"; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you move this and "inline" the content of registered()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is PR merge issue, it's correct in the loom repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The .1 nroff files are no longer in the repo, you need to edit the markdown source instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was already pointed out, I think the PR was merged from an older version.
| jcmd().shouldContain("Virtual thread scheduler:") | ||
| .shouldContain(Objects.toIdentityString(defaultScheduler())) | ||
| .shouldContain("Timeout schedulers:") | ||
| .shouldContain("[0] " + ScheduledThreadPoolExecutor.class.getName()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again please align dots on chained calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the IDE will of course re-align it at next edit :-)
|
@larry-cable This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
|
@larry-cable This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the |
c.f: https://bugs.openjdk.org/browse/JDK-8339420
Summary
Add
jcmd <pid> Thread.vthread_summaryto 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
jcmdcommand 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.
The "Virtual thread scheduler" section show the target parallelism, the number of threads in the scheduler's pool, and other useful counters.
The "Timeout schedulers" section provides information on the usage of the ScheduledThreadPoolExecutor used to support virtual thread doing timed operations.
The "I/O pollers" section will vary by OS. The sample output here is macOS which, by default, has a one read and one write poller. This is useful to see how many blocking network I/O operations on virtual threads are in progress.
The "Thread groupings" appears a support people to get a sense of how the virtual threads are grouped. Virtual threads created directly with the Thread API are in the "root" grouping. Some servers may have one or more ThreadPerTaskExecutor instances. For now, this section doesn't print the tree of thread groupings that arises when using the Structured Concurrency API.
Specification
The output from
jcmd <pid> Thread.vthread_summary -helpis:Progress
Integration blocker
Warnings
Issues
Backport <hash>with the hash of the original commit. See Backports.Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22121/head:pull/22121$ git checkout pull/22121Update a local copy of the PR:
$ git checkout pull/22121$ git pull https://git.openjdk.org/jdk.git pull/22121/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22121View PR using the GUI difftool:
$ git pr show -t 22121Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22121.diff
Using Webrev
Link to Webrev Comment