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

Documentation for -XX:[+|-]EnableDynamicAgentLoading #1174

Merged

Conversation

Sreekala-Gopakumar
Copy link
Contributor

#1140

Created a new topic for the -XX:[+|-]EnableDynamicAgentLoading option Updated the related topics.

Closes #1140
Signed-off-by: Sreekala Gopakumar sreekala.gopakumar@ibm.com

@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

1 similar comment
@pshipton
Copy link
Member

Jenkins doc stage

@Sreekala-Gopakumar
Copy link
Contributor Author

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

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.

@Sreekala-Gopakumar I made a few clarifications, please let me know if you have further questions.

@@ -0,0 +1,60 @@
<!--
* Copyright (c) 2017, 2023 IBM Corp. and others
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Copyright (c) 2017, 2023 IBM Corp. and others
* Copyright (c) 2023, 2023 IBM Corp. and others

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As per the Contribution guidelines, copyright dates are not changed, even for a new topic; the dates refer to the complete documentation set, not to individual files and so should be the same in all topics.

https://github.com/eclipse-openj9/openj9-docs/blob/master/CONTRIBUTING.md#style-guidelines


You can disable the dynamic loading of the agents into a VM after startup with the `-XX:-EnableDynamicAgentLoading` option.

![Start of content that applies to Java 21 (LTS) and later](cr/java21plus.png) For Java&trade; 21 and later, the following warnings are issued when the agents are loaded dynamically into a running VM after startup without specifying the `-XX:+EnableDynamicAgentLoading` option and the same agents were not loaded at startup by using the [command-line options](interface_jvmti.md#overview):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
![Start of content that applies to Java 21 (LTS) and later](cr/java21plus.png) For Java&trade; 21 and later, the following warnings are issued when the agents are loaded dynamically into a running VM after startup without specifying the `-XX:+EnableDynamicAgentLoading` option and the same agents were not loaded at startup by using the [command-line options](interface_jvmti.md#overview):
![Start of content that applies to Java 21 (LTS) and later](cr/java21plus.png) For Java&trade; 21 and later, the following warnings are issued when the agents are loaded dynamically into a running VM after startup without specifying the `-XX:+EnableDynamicAgentLoading` option and the same agents were not loaded before at startup by using the [command-line options](interface_jvmti.md#overview) or an earlier dynamical loading, i.e., the warnings are only issued once even if it is dynamically loaded multiple times:

Copy link
Contributor Author

@Sreekala-Gopakumar Sreekala-Gopakumar Sep 21, 2023

Choose a reason for hiding this comment

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

@JasonFengJ9 - If the agents are loaded dynamically into a running VM after startup after specifying the -XX:+EnableDynamicAgentLoading option, but the same agents were loaded before, the warnings will be issued?

the warnings are only issued once even if it is dynamically loaded multiple times:

I am not clear about this. if an agent is loaded without the XX:+EnableDynamicAgentLoading option multiple times. then won't the warnings be issued each time that agent is loaded?

Also, if the agent was loaded at startup with the command-line option or through dynamic loading (with the XX:+EnableDynamicAgentLoading option), then if that same agent is dynamically loaded again but without the XX:+EnableDynamicAgentLoading option, then the warning will be issued, right?

Copy link
Member

Choose a reason for hiding this comment

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

If the agents are loaded dynamically into a running VM after startup after specifying the -XX:+EnableDynamicAgentLoading option, but the same agents were loaded before, the warnings will be issued?

If -XX:+EnableDynamicAgentLoading is specified which is only possible at the VM startup command line options, there will be NO warnings always.

the warnings are only issued once even if it is dynamically loaded multiple times:

I am not clear about this. if an agent is loaded without the XX:+EnableDynamicAgentLoading option multiple times. then won't the warnings be issued each time that agent is loaded?

The warnings only appear once for the same agent when -XX:+EnableDynamicAgentLoading is not specified.

Also, if the agent was loaded at startup with the command-line option or through dynamic loading (with the XX:+EnableDynamicAgentLoading option), then if that same agent is dynamically loaded again but without the XX:+EnableDynamicAgentLoading option, then the warning will be issued, right?

Note that -XX:+EnableDynamicAgentLoading is a JVM startup command line option and affects all agent loading afterwards, i.e., if it is set at startup, all agents dynamically loaded regardless of their names/paths are considered approved by the application owner, and no warnings will be issued.

WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
WARNING: Dynamic loading of agents will be disallowed by default in a future release
```
AIX&reg; systems cannot detect whether an agent library was previously loaded at startup or not. Therefore, the warnings are issued when an agent is loaded dynamically through the Attach API (`VirtualMachine.loadAgentLibrary(agent)`) even if the agent was loaded through the command-line option (`-agentpath:/Absolute/Path/to/agentLibrary`) at startup. ![End of content that applies to Java 21 (LTS) and later](cr/java_close_lts.png)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
AIX&reg; systems cannot detect whether an agent library was previously loaded at startup or not. Therefore, the warnings are issued when an agent is loaded dynamically through the Attach API (`VirtualMachine.loadAgentLibrary(agent)`) even if the agent was loaded through the command-line option (`-agentpath:/Absolute/Path/to/agentLibrary`) at startup. ![End of content that applies to Java 21 (LTS) and later](cr/java_close_lts.png)
AIX&reg; systems cannot detect whether an agent library was previously loaded or not if the library was loaded through a different name and path. Therefore, the warnings are issued when an agent is loaded dynamically through the Attach API (`VirtualMachine.loadAgentLibrary(agent)`) even if the agent was loaded through the command-line option (`-agentpath:/Absolute/Path/to/agentLibrary`) at startup. If a library is loaded with the same name or absolute path multiple times, OpenJ9 JVM can detect that and only issue one warning message which is not AIX-specific capability. ![End of content that applies to Java 21 (LTS) and later](cr/java_close_lts.png)

Copy link
Contributor Author

@Sreekala-Gopakumar Sreekala-Gopakumar Sep 21, 2023

Choose a reason for hiding this comment

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

@JasonFengJ9 - What do you mean by "only issue one warning message which is not AIX-specific capability"?

...the warnings are issued when an agent is loaded dynamically through the Attach API (VirtualMachine.loadAgentLibrary(agent)) even if the agent was loaded through the command-line option (-agentpath:/Absolute/Path/to/agentLibrary) at startup.

Here, you mean " when an agent is loaded dynamically with the -XX:+EnableDynamicAgentLoading option"?

Copy link
Member

Choose a reason for hiding this comment

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

What do you mean by "only issue one warning message which is not AIX-specific capability"?

If an agent is loaded dynamically with the same name or absolute path, OpenJ9 VM is able to compare it with previously loaded libraries and determine if it was already loaded, in case the agent library was loaded before, no more warnings are issued.
However, if the same library is loaded differently, for example, one with a platform-independent name such as VirtualMachine.loadAgentLibrary(agent), and the other with an absolute file path -agentpath:/Absolute/Path/to/agentLibrary, this use case requires the OS API to determine if the same library was loaded, AIX doesn't have such APIs like other platforms supported by OpenJ9, hence another warnings will be issued.

@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

@Sreekala-Gopakumar
Copy link
Contributor Author

@JasonFengJ9 - I have incorporated the changes. Please check and confirm. Thanks!

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.

A few more minor comments, please incorporate them.


You can disable the dynamic loading of the agents into a VM after startup with the `-XX:-EnableDynamicAgentLoading` option.

![Start of content that applies to Java 21 (LTS) and later](cr/java21plus.png) For Java&trade; 21 and later, the following warnings are issued when the agents are loaded dynamically into a running VM after startup without specifying the `-XX:+EnableDynamicAgentLoading` option. These warnings are not issued if the same agents were loaded before at startup either by using the [command-line options](interface_jvmti.md#overview) or an earlier dynamic loading.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
![Start of content that applies to Java 21 (LTS) and later](cr/java21plus.png) For Java&trade; 21 and later, the following warnings are issued when the agents are loaded dynamically into a running VM after startup without specifying the `-XX:+EnableDynamicAgentLoading` option. These warnings are not issued if the same agents were loaded before at startup either by using the [command-line options](interface_jvmti.md#overview) or an earlier dynamic loading.
![Start of content that applies to Java 21 (LTS) and later](cr/java21plus.png) For Java&trade; 21 and later, the following warnings are issued when the agents are loaded dynamically into a running VM after startup without specifying the `-XX:+EnableDynamicAgentLoading` option. These warnings are not issued if the same agents were loaded before either by using the [command-line options](interface_jvmti.md#overview) at startup or an earlier dynamic loading.

Note: an agent dynamic loading always occurs after VM startup.


These warnings are issued only once for the same agent when the `-XX:+EnableDynamicAgentLoading` option is not specified.

If the `-XX:+EnableDynamicAgentLoading` option is set at startup, all agents that are dynamically loaded are considered as approved by the application owner, and therefore, no warnings are issued.
Copy link
Member

Choose a reason for hiding this comment

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

Also, note here that a command line option can only be specified at VM startup, not sure if "at startup" here is required.


If the `-XX:+EnableDynamicAgentLoading` option is set at startup, all agents that are dynamically loaded are considered as approved by the application owner, and therefore, no warnings are issued.

Eclipse OpenJ9&trade; supported operating systems other than AIX&reg; have APIs to determine whether the same agent was loaded before or not, even if an agent is loaded with the same or different name and absolute path.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Eclipse OpenJ9&trade; supported operating systems other than AIX&reg; have APIs to determine whether the same agent was loaded before or not, even if an agent is loaded with the same or different name and absolute path.
Eclipse OpenJ9&trade; supported operating systems other than AIX&reg; have APIs to determine whether the same agent was loaded before or not, even if an agent is loaded with a platform-independent name or an absolute path to the platform-dependent library.


Eclipse OpenJ9&trade; supported operating systems other than AIX&reg; have APIs to determine whether the same agent was loaded before or not, even if an agent is loaded with the same or different name and absolute path.

AIX systems cannot detect whether an agent was previously loaded or not if the agent was loaded through a different name or path. Therefore, on AIX systems, the warnings are issued when an agent is loaded dynamically through the Attach API (`VirtualMachine.loadAgentLibrary(agent)`) even if the same agent was loaded before through the command-line option (`-agentpath:/Absolute/Path/to/agentLibrary`) at startup. ![End of content that applies to Java 21 (LTS) and later](cr/java_close_lts.png)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
AIX systems cannot detect whether an agent was previously loaded or not if the agent was loaded through a different name or path. Therefore, on AIX systems, the warnings are issued when an agent is loaded dynamically through the Attach API (`VirtualMachine.loadAgentLibrary(agent)`) even if the same agent was loaded before through the command-line option (`-agentpath:/Absolute/Path/to/agentLibrary`) at startup. ![End of content that applies to Java 21 (LTS) and later](cr/java_close_lts.png)
AIX systems cannot detect whether an agent was previously loaded or not if the agent was loaded through a platform-independent name or an absolute path to the platform-dependent library. Therefore, on AIX systems, the warnings are issued when an agent is loaded dynamically through the Attach API (`VirtualMachine.loadAgentLibrary(agent)`) even if the same agent was loaded before through the command-line option (`-agentpath:/Absolute/Path/to/agentLibrary`) at startup. ![End of content that applies to Java 21 (LTS) and later](cr/java_close_lts.png)

eclipse-openj9#1140

Created a new topic for the -XX:[+|-]EnableDynamicAgentLoading option Updated the related topics. Incorporated the review feedback.

Closes eclipse-openj9#1140
Signed-off-by: Sreekala Gopakumar <sreekala.gopakumar@ibm.com>
@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

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

Thanks @Sreekala-Gopakumar

@Sreekala-Gopakumar
Copy link
Contributor Author

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

@Sreekala-Gopakumar
Copy link
Contributor Author

Sreekala-Gopakumar commented Sep 22, 2023

@pshipton - Jason has approved the changes. Can this be merged or are there any other changes that you might want me to make? Thanks!

@pshipton - Any feedback?

@Sreekala-Gopakumar
Copy link
Contributor Author

Jenkins doc stage

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.

Documentation for -XX:[+|-]EnableDynamicAgentLoading
3 participants