Skip to content

Conversation

coffeys
Copy link
Contributor

@coffeys coffeys commented Oct 17, 2025

Simple tweak to jcmd Thread.print help message

jdk_svc test group ran and green


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8370071: Clarify jcmd Thread.print help message (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27861/head:pull/27861
$ git checkout pull/27861

Update a local copy of the PR:
$ git checkout pull/27861
$ git pull https://git.openjdk.org/jdk.git pull/27861/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27861

View PR using the GUI difftool:
$ git pr show -t 27861

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27861.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 17, 2025

👋 Welcome back coffeys! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 17, 2025

@coffeys This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8370071: Clarify jcmd Thread.print help message

Reviewed-by: kevinw

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 20 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot changed the title 8370071 8370071: Clarify jcmd Thread.print help message Oct 17, 2025
@openjdk
Copy link

openjdk bot commented Oct 17, 2025

@coffeys The following labels will be automatically applied to this pull request:

  • hotspot-runtime
  • serviceability

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.

@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 17, 2025
@mlbridge
Copy link

mlbridge bot commented Oct 17, 2025

Webrevs

@coffeys
Copy link
Contributor Author

coffeys commented Oct 17, 2025

Any issues if I add this sentence to the help output ?

“Use Thread.dump_to_file command for extended threads detail including virtual thread information."

Copy link
Contributor

@kevinjwalls kevinjwalls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea, this could be clearer.

If you want to expand this:
Elsewhere for ThreadDumpToFileDCmd we say:
"Dump threads, with stack traces, to a file in plain text or JSON format."
We could add on: "Includes virtual threads." or add in that fact somehow.

There's also a man page ./src/jdk.jcmd/share/man/jcmd.md where we have the same text for both commands. 8-)

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 17, 2025
static const char* name() { return "Thread.print"; }
static const char* description() {
return "Print all threads with stacktraces.";
return "Print all platform threads with stacktraces.";
Copy link
Contributor

@AlanBateman AlanBateman Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Thread.print section of the jcmd man page can be updated to align with the update description.

If there is space, then we could include "and all mounted virtual threads".

(Note that there was a previous attempt to change this description when the Thread.print was updated to include mounted virtual threads. At the time, the PR feedback was to separate it to a different PR but there wasn't any follow-up on that so good to see it re-visited here)

@coffeys
Copy link
Contributor Author

coffeys commented Oct 17, 2025

Good idea, this could be clearer.

If you want to expand this: Elsewhere for ThreadDumpToFileDCmd we say: "Dump threads, with stack traces, to a file in plain text or JSON format." We could add on: "Includes virtual threads." or add in that fact somehow.

There's also a man page ./src/jdk.jcmd/share/man/jcmd.md where we have the same text for both commands. 8-)

Thanks for the man page reminder Kevin. I've added some extra help information also. I think it'll help guide users of these tools. PR updated.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 17, 2025
@kevinjwalls
Copy link
Contributor

Saying "extended threads detail", or even "extended thread details" is a bit vague. It's not clear what Thread.print misses out, or if this will always be true. Could it be just: "Use Thread.dump_to_file for virtual thread information."

}
static const char *description() {
return "Dump threads, with stack traces, to a file in plain text or JSON format.";
return "Dump threads (including virtual), with stack traces, "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change it to "Dump all threads" then it would be simpler.

return "Print all platform threads with stacktraces.";
return "Print all platform threads with stacktraces. "
"Use Thread.dump_to_file command for extended threads "
"detail including virtual thread information.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try "Print all platform threads, and mounted virtual threads, with stack traces"?

Not sure about the second line. I assume you are proposing to add this in order to created awareness but saying "extended threads detail" is confusing. If a second line is added then it could be very simple, e.g. "The Thread.dump_to_file command will print all threads to a file".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - nice to have the "mounted virtual threads" clarity.

"The Thread.dump_to_file command will print all threads to a file". --> Will run with that. thanks.

I think it's useful to hint at these commands when end users are reading such help messages.
(e.g. "I want to print thread information but this command is telling me I only get platform + mounted threads.. what do I use for all threads etc.")

@coffeys
Copy link
Contributor Author

coffeys commented Oct 17, 2025

Saying "extended threads detail", or even "extended thread details" is a bit vague. It's not clear what Thread.print misses out, or if this will always be true. Could it be just: "Use Thread.dump_to_file for virtual thread information."

Yes - that's a fair point. The dump_to_file option also prints j.u.c Lock information for virtual theads. (hence extended)
Thread.print prints details of a virtual thread if it's mounted.

but yes, "Use Thread.dump_to_file for virtual thread information." sounds better. Maybe even ""Use Thread.dump_to_file for all thread information." based on Alan's comment.

@kevinjwalls
Copy link
Contributor

By: "Use Thread.dump_to_file for all thread information."
do we mean:
"Use Thread.dump_to_file for information on all threads."

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 17, 2025
@coffeys
Copy link
Contributor Author

coffeys commented Oct 20, 2025

Thanks for the reviews

/integrate

@openjdk
Copy link

openjdk bot commented Oct 20, 2025

Going to push as commit ee35320.
Since your change was applied there have been 45 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 20, 2025
@openjdk openjdk bot closed this Oct 20, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 20, 2025
@openjdk
Copy link

openjdk bot commented Oct 20, 2025

@coffeys Pushed as commit ee35320.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

return "Print all threads with stacktraces.";
return "Print all platform threads, and mounted virtual threads, "
"with stack traces. The Thread.dump_to_file command will "
"print all threads to a file.";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still in two minds about having it mention Thread.dump_to_file. If it is mentioned then it would be better to put in a line break and use "may be used to" that rather than "will".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - happy to tweak this in follow on issue if necessary. I think it reads fine as is but let me know the final format and I'll file a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants