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

jcmd supports VMID query via Java process display name #1301

Merged
merged 1 commit into from
Mar 25, 2024

Conversation

Sreekala-Gopakumar
Copy link
Contributor

#1292

Updated the related topics with the change in jcmd VMID query behavior

Closes #1292
Signed-off-by: Sreekala Gopakumar [email protected]

@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

docs/tool_jcmd.md Outdated Show resolved Hide resolved
docs/tool_migration.md Outdated Show resolved Hide resolved
docs/version0.44.md Outdated Show resolved Hide resolved
@@ -39,6 +39,10 @@ Where:

- `<vmid>` is the Attach API virtual machine identifier for the Java&trade; VM process. This ID is often, but not always, the same as the operating system *process ID*. One example where the ID might be different is if you specified the system property `-Dcom.ibm.tools.attach.id` when you started the process. You can use the [`jps`](tool_jps.md) command to find the VMID.

You can also specify the full or partial Java process display name instead of the VMID. The `jcmd` tool finds the corresponding VMID of the display name and runs the `jcmd` command.
Copy link
Member

Choose a reason for hiding this comment

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

What is a Java process display name, is this defined somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, not specifically. But, I can see display name mentioned in https://eclipse.dev/openj9/docs/dcomibmtoolsattachdisplayname/. Is this same as Java process display name? Could you specify any other definition that I should add? Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Jason pls help clear this up. The linked topic https://eclipse.dev/openj9/docs/dcomibmtoolsattachdisplayname/ could use more explanation of what the display name is, what is the default, what it's used for.

Copy link
Member

@JasonFengJ9 JasonFengJ9 Mar 19, 2024

Choose a reason for hiding this comment

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

Jcmd or Jcmd -l lists current java processes recognized by this utility, the list comes with two columns, one is VMID which usually is the process id, and the other is the display name.

The display name for a virtual machine could be specified via a system property com.ibm.tools.attach.displayName as per https://eclipse.dev/openj9/docs/dcomibmtoolsattachdisplayname/, otherwise it is the main class name along with the application arguments.

Copy link
Member

Choose a reason for hiding this comment

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

So basically the default display name is the entire java command line. I don't know that sun.java.command is documented so better not to mention it.

Copy link
Member

Choose a reason for hiding this comment

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

Replace it with the main class name along with the application arguments.

Copy link
Contributor Author

@Sreekala-Gopakumar Sreekala-Gopakumar Mar 20, 2024

Choose a reason for hiding this comment

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

Jcmd or Jcmd -l lists current java processes recognized by this utility, the list comes with two columns, one is VMID which usually is the process id, and the other is the display name.

The display name for a virtual machine could be specified via a system property com.ibm.tools.attach.displayName as per https://eclipse.dev/openj9/docs/dcomibmtoolsattachdisplayname/, otherwise it is the main class name along with the application arguments.

@JasonFengJ9 - Is it "The display name for a virtual machine" or "The display name for the Java VM process", or "The display name for the Attach API virtual machine" or "The display name for the target virtual machine on which the jcmd command must run."?

  • is -l, one of the options available for jcmd in addition to -J and -h?
  • Also, do both jcmd and jcmd -l list the current java processes recognized by this utility? i.e. even if we don't specify the -l option, will it still list the current java processes?

Copy link
Member

Choose a reason for hiding this comment

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

Is it "The display name for a virtual machine" or "The display name for the Java VM process", or "The display name for the Attach API virtual machine" or "The display name for the target virtual machine on which the jcmd command must run."?

When Jcmd or other AttachAPI utilities list the currently running Java processes, the display name refers to the target Java process that could be attached by Jcmd.

is -l, one of the options available for jcmd in addition to -J and -h?

Correct.

Also, do both jcmd and jcmd -l list the current java processes recognized by this utility? i.e. even if we don't specify the -l option, will it still list the current java processes?

Yes, -l is the default option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is the following correct? Especially this part jcmd [pid | main-class] command. I saw this mentioned in eclipse-openj9/openj9#19045 (comment)

The display name for a target VM is specified either through a system property com.ibm.tools.attach.displayName, or by specifying the main class name along with the application arguments - jcmd [pid | main-class] command.

Copy link
Member

Choose a reason for hiding this comment

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

The main-class (along with application arguments) are the default display name if no system property com.ibm.tools.attach.displayName was set.

Suggest changing to something like following:
The display name for a target VM is specified through a system property com.ibm.tools.attach.displayName, or by default the main class name along with the application arguments - jcmd [pid | main-class] command.

@Sreekala-Gopakumar Sreekala-Gopakumar force-pushed the 1292JCMD branch 2 times, most recently from 8aad2cf to b17f32c Compare March 20, 2024 15:40
@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

1 similar comment
@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

@Sreekala-Gopakumar
Copy link
Contributor Author

@JasonFengJ9 @pshipton - I have updated the documents. Please check and confirm. Thanks!

docs/tool_jcmd.md Outdated Show resolved Hide resolved
@pshipton
Copy link
Member

Can we pls add the information describing the default display name into the https://eclipse.dev/openj9/docs/dcomibmtoolsattachdisplayname/ topic.

@Sreekala-Gopakumar
Copy link
Contributor Author

Sreekala-Gopakumar commented Mar 21, 2024

Can we pls add the information describing the default display name into the https://eclipse.dev/openj9/docs/dcomibmtoolsattachdisplayname/ topic.

In the existing content, default is described as "The command line invocation used to start the application", which doesn't make sense. Can I replace this line with "Main class name along with the application arguments"? Will that be correct?

Does the -Dcom.ibm.tools.attach.displayName system property have a specific default value of its own?

Or is it just that if the nothing is specified in the system property then the display name is set as "Main class name along with the application arguments and not that the system property is defaulted to "Main class name along with the application arguments"?

Thanks!

@pshipton
Copy link
Member

pshipton commented Mar 21, 2024

Can I replace this line with "Main class name along with the application arguments"?

Works for me.

Or is it just that if nothing is specified in the system property then the display name is set as ...

Yes

@Sreekala-Gopakumar
Copy link
Contributor Author

Can I replace this line with "Main class name along with the application arguments"?

Works for me.

Or is it just that if nothing is specified in the system property then the display name is set as ...

Yes

Then, that means "Main class name along with the application arguments" is not the default value of -Dcom.ibm.tools.attach.displayName system property, isn't it? Maybe, I can delete the Default column. And give the content regarding the default display name below the table. Hope that is ok.

@pshipton
Copy link
Member

Hope that is ok.

I agree. I didn't even notice the default value column described the behavior until you mentioned it.

@Sreekala-Gopakumar Sreekala-Gopakumar force-pushed the 1292JCMD branch 2 times, most recently from 7e7af7b to 87ca04a Compare March 21, 2024 15:54
@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

@Sreekala-Gopakumar
Copy link
Contributor Author

@pshipton - I have made the changes. Please check and confirm. Thanks!


You can specify the display name for a target VM through the [`com.ibm.tools.attach.displayName`](dcomibmtoolsattachdisplayname.md) system property. If the display name is not set through the system property, then the main class name along with the application arguments is set as the default display name. The command syntax is as follows:

jcmd [pid | main-class] command
Copy link
Member

Choose a reason for hiding this comment

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

I still don't understand the purpose of this. The jcmd command syntax is already shown on line 32 as jcmd <vmid | display name | 0> <arguments>, why do we want to state it again here, in a paragraph describing the display name, and using different parameter names, ie. pid vs vmid, main-class vs display name, command vs arguments.

@Sreekala-Gopakumar Sreekala-Gopakumar force-pushed the 1292JCMD branch 2 times, most recently from e14345f to f69a4bd Compare March 22, 2024 01:04
@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

@Sreekala-Gopakumar
Copy link
Contributor Author

@pshipton - I have made the change. Thanks!

@pshipton
Copy link
Member

@JasonFengJ9 any further concerns?

docs/version0.44.md Outdated Show resolved Hide resolved
Copy link
Member

@JasonFengJ9 JasonFengJ9 left a comment

Choose a reason for hiding this comment

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

LGTM

docs/tool_jcmd.md Outdated Show resolved Hide resolved
@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

@Sreekala-Gopakumar
Copy link
Contributor Author

@pshipton - Please check and confirm. Thanks!

eclipse-openj9#1292

Updated the related topics with the change in jcmd VMID query behavior. Incorporated the feedback

Closes eclipse-openj9#1292
Signed-off-by: Sreekala Gopakumar <[email protected]>
@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

@pshipton pshipton merged commit eb76b82 into eclipse-openj9:master Mar 25, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttachAPI jcmd supports VMID query via Java process display name fully or partially
3 participants