Skip to content
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

8338603: DiagnosticCommandMBean operations should standardize types for parameters #21040

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

kevinjwalls
Copy link
Contributor

@kevinjwalls kevinjwalls commented Sep 17, 2024

DiagnosticCommandImpl should only publish parameter types in a known standard set, and use "STRING" on anything else.
e.g. We can say "FILE" in the help output for jcmd, as that's for humans, but the MBean parameter info should contain "STRING".


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-8338603: DiagnosticCommandMBean operations should standardize types for parameters (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21040

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 17, 2024

👋 Welcome back kevinw! 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 Sep 17, 2024

@kevinjwalls 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:

8338603: DiagnosticCommandMBean operations should standardize types for parameters

Reviewed-by: cjplummer

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 44 new commits pushed to the master branch:

  • 472db92: 8341900: Optimize DirectCodeBuilder writeBody
  • 24eb360: 8341906: Optimize ClassFile writing BufBuffer
  • cd4981c: 8341257: Open source few DND tests - Set1
  • 06f34d7: 8339651: ShenandoahPacer::setup_for_mark, ShenandoahPacer::setup_for_updaterefs and ShenandoahPacer::setup_for_evac runtime error: division by zero
  • 97ee8bb: 8340173: Open source some Component/Panel/EventQueue tests - Set2
  • 2a6f030: 8339974: Graphics2D.drawString doesn't always work with Font derived from AffineTransform
  • 32f817a: 8340978: Open source few DnD tests - Set6
  • a5cad0e: 8341791: Fix ExceptionOccurred in java.prefs
  • 7eb5535: 8341789: Fix ExceptionOccurred in java.base
  • 76541b0: 8341792: Fix ExceptionOccurred in java.security.jgss
  • ... and 34 more: https://git.openjdk.org/jdk/compare/d3f3c6a8cdf862df3a72f60c824ce50d37231061...master

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
Copy link

openjdk bot commented Sep 17, 2024

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

  • jmx
  • 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 serviceability serviceability-dev@openjdk.org jmx jmx-dev@openjdk.org labels Sep 17, 2024
@kevinjwalls kevinjwalls changed the title 8338603: DiagnosticCommandMBean operations should standardize types for parameters. 8338603: DiagnosticCommandMBean operations should standardize types for parameters Sep 17, 2024
@kevinjwalls
Copy link
Contributor Author

DiagnosticCommandMBean provides JMX/MBean access to DiagnosticCommands, aka jcmds, as operations.
https://docs.oracle.com/en/java/javase/22/docs/api/jdk.management/com/sun/management/DiagnosticCommandMBean.html

The range of types for operation parameters is not well specified. In "dcmd.arg.type" it is: "the name of a type recognized by the diagnostic command parser. These types are not Java types and are implementation dependent."

We never clarify the range of type names an application can see via the MBean. JMC for example has a historical connection, so it just knows the implementation-specific parameter types to expect.

I suggested in a jcmd change that we add a FILE parameter type, it is informative for humans and can have specific meaning internally in addition to being a String. However we find JMC does not recognise it and does not permit editing that operation parameter. It wasn't clear to me at the time that these jcmd/DCmd parameter type names were consumed by other software (i.e. not just appearing in the help, for humans).

Standardising or at least ensuring the parameter type list is stable, is needed. No need to change the documentation at this stage, this can be still be implementation dependent.

We can't standardise on Java or OpenType names or applications such as JMC will break significantly. But we can standardise on the core list of parameter types that we have:

BOOLEAN, STRING and INT are the main types.
NANOTIME tells the user they can type "6s" or "10m" and be understood (JFR commands use this)
"MEMORY SIZE" tells the user they can type "32m" and be understood. (Compiler.memory and JFR commands use this)
"STRING SET" is an array of Strings. JMC does handle it (Only JFR.start uses this. Maybe it doesn't need it, but separate issue...)

(JULONG had been added, but was not handled by apps e.g. JMC, and replacement with INT is in progress separately, JDK-8340113.)

If a DiagnosticCommand parameter has a type which is outside the standard list, it should publish it via the MBean Operation with a dcmd.arg.type of STRING to avoid confusing applications.

An existing test (DcmdMBeanTest.java) finds dcmds and shows parameters, e.g. dcmd.arg.type=STRING
This test can verify parameter types observed via the MBean are of the known published set.

@kevinjwalls kevinjwalls marked this pull request as ready for review September 18, 2024 10:07
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 18, 2024
@mlbridge
Copy link

mlbridge bot commented Sep 18, 2024

Webrevs

@kevinjwalls
Copy link
Contributor Author

Hi,
Looking for input. We do need this change, or something like it, as we have the FILE type out there in the product, and JMC does not understand it (nor would any other app).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jmx jmx-dev@openjdk.org ready Pull request is ready to be integrated rfr Pull request is ready for review serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

2 participants