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

JDK21+ AIX prints a warning message for the same library previously loaded #1264

Closed
JasonFengJ9 opened this issue Jan 30, 2024 · 15 comments · Fixed by #1270 or #1290
Closed

JDK21+ AIX prints a warning message for the same library previously loaded #1264

JasonFengJ9 opened this issue Jan 30, 2024 · 15 comments · Fixed by #1270 or #1290

Comments

@JasonFengJ9
Copy link
Member

JasonFengJ9 commented Jan 30, 2024

Issue or pull request number:
eclipse-openj9/openj9#18845
eclipse-openj9/openj9#17990

Overview:
If an agent library was previously loaded via the command line or AttachAPI dynamically in the AIX platform and a warning message was printed, another loading of the same library will print "WARNING: A JVM TI agent has been loaded dynamically" again.

See #1264 (comment) for more details.

Release target:
Eclipse OpenJ9 0.44

Applies to the following JDK versions:
21 and later

Applies to the following platforms:
AIX

For new command line options:

  • Option name and syntax: -XX:[+|-]EnableDynamicAgentLoading

An agent library can be loaded via an existing command line option -agentpath:.
When -XX:-EnableDynamicAgentLoading is specified, there will be no agent dynamical loading allowed and no more than one warning message to be printed.
When -XX:+EnableDynamicAgentLoading is specified which is on by default, an agent library can be loaded dynamically via jcmd command JVMTI.agent_load.

A workaround to avoid multiple warning messages is to only load the same library once.

FYI @pshipton @tajila

@pshipton
Copy link
Member

Is there any workaround? How does the command option option affect the behavior?

@JasonFengJ9
Copy link
Member Author

Is there any workaround? How does the command option option affect the behavior?

Added the following in the issue description:

There are no new command line options. An agent library can be loaded via an existing command line option -agentpath: or jcmd command JVMTI.agent_load.

A workaround to avoid multiple warning messages is to only load the same library once.

@pshipton
Copy link
Member

pshipton commented Jan 30, 2024

JEP451 adds a command line option, -XX:[+/-]EnableDynamicAgentLoading. So with -XX:-EnableDynamicAgentLoading you can't load the library at all, and with -XX:+EnableDynamicAgentLoading you get a warning if the library is loaded more than once (every time it's loaded), is that correct?

@pshipton
Copy link
Member

And the difference between AIX and other platforms is that on AIX you get the warning every time the duplicate library is loaded, and for other platforms you only the warning the first time a dup library is loaded, correct?

@pshipton
Copy link
Member

Also, for OpenJ9 this isn't a change in behavior from the previous release? But now OpenJDK has fixed AIX to only show the warning the first time, and OpenJ9 will make that change in the next release.

@JasonFengJ9
Copy link
Member Author

JEP451 adds a command line option, -XX:[+/-]EnableDynamicAgentLoading. So with -XX:-EnableDynamicAgentLoading you can't load the library at all, and with -XX:+EnableDynamicAgentLoading you get a warning if the library is loaded more than once (every time it's loaded), is that correct?

Correct.

And the difference between AIX and other platforms is that on AIX you get the warning every time the duplicate library is loaded, and for other platforms you only the warning the first time a dup library is loaded, correct?

Correct.

Also, for OpenJ9 this isn't a change in behavior from the previous release? But now OpenJDK has fixed AIX to only show the warning the first time, and OpenJ9 will make that change in the next release.

Correct.

Updated the issue description.

@Sreekala-Gopakumar
Copy link
Contributor

Sreekala-Gopakumar commented Feb 5, 2024

Also, for OpenJ9 this isn't a change in behavior from the previous release? But now OpenJDK has fixed AIX to only show the warning the first time, and OpenJ9 will make that change in the next release.

So this means that now AIX systems can 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?

Now, on AIX also if the -XX:+EnableDynamicAgentLoading option is set, warning will be displayed but unlike other platforms, multiple warnings instead of a single warning will be displayed if the library is loaded more than once?

JEP451 adds a command line option, -XX:[+/-]EnableDynamicAgentLoading. So with -XX:-EnableDynamicAgentLoading you can't load the library at all, and with -XX:+EnableDynamicAgentLoading you get a warning if the library is loaded more than once (every time it's loaded), is that correct?

@pshipton @JasonFengJ9 - As per #1140, "For Java 21 and later, the warnings are issued when an agent is loaded dynamically into a running VM after startup without specifying the -XX:+EnableDynamicAgentLoading option and the same agent wasn't loaded before."
Also, in the existing content, we are saying "If the -XX:+EnableDynamicAgentLoading option is set, all agents that are dynamically loaded are considered as approved by the application owner, and therefore, no warnings are issued." Please see #1174 (comment) also. This seems contrary to the following comment

So with -XX:-EnableDynamicAgentLoading you can't load the library at all, and with -XX:+EnableDynamicAgentLoading you get a warning if the library is loaded more than once (every time it's loaded), is that correct

@JasonFengJ9
Copy link
Member Author

So this means that now AIX systems can 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?

This hasn't happened yet until eclipse-openj9/openj9#18881 is approved & merged.

Now, on AIX also if the -XX:+EnableDynamicAgentLoading option is set, warning will be displayed but unlike other platforms, multiple warnings instead of a single warning will be displayed if the library is loaded more than once?

On AIX if the -XX:+EnableDynamicAgentLoading option is NOT set, the warning will be displayed but unlike other platforms, multiple warnings instead of a single warning will be displayed if the library is loaded more than once?

This seems contrary to the following comment

So with -XX:-EnableDynamicAgentLoading you can't load the library at all, and with -XX:+EnableDynamicAgentLoading you get a warning if the library is loaded more than once (every time it's loaded), is that correct

Good catch. The existing context is correct instead:
"If the -XX:+EnableDynamicAgentLoading option is set, all agents that are dynamically loaded are considered as approved by the application owner, and therefore, no warnings are issued."

@Sreekala-Gopakumar
Copy link
Contributor

Sreekala-Gopakumar commented Feb 6, 2024

This hasn't happened yet until eclipse-openj9/openj9#18881 is approved & merged.

So, should I be documenting this as of now or should I keep it ready and reviewed and it can be merged as and when it is approved?

@JasonFengJ9
Copy link
Member Author

This hasn't happened yet until eclipse-openj9/openj9#18881 is approved & merged.

So, should I be documenting this as of now or should I keep it ready and reviewed and it can be merged as and when it is approved?

The PR won't be merged into 0.43. This doc is for the 0.43 known issue.

@Sreekala-Gopakumar
Copy link
Contributor

This hasn't happened yet until eclipse-openj9/openj9#18881 is approved & merged.

So, should I be documenting this as of now or should I keep it ready and reviewed and it can be merged as and when it is approved?

The PR won't be merged into 0.43. This doc is for the 0.43 known issue.

Could you clarify what you meant by "This doc is for the 0.43 known issue." What issue is being fixed that needed update in the documentation? I mean, we already have in our documents that

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.

@pshipton
Copy link
Member

pshipton commented Feb 6, 2024

What changed is that in 21.0.2 the Hotspot behavior changed so that AIX doesn't have this problem any more, but OpenJ9 still has the issue with 21.0.2, it will be resolved in 21.0.3.

@Sreekala-Gopakumar
Copy link
Contributor

Sreekala-Gopakumar commented Feb 6, 2024

What changed is that in 21.0.2 the Hotspot behavior changed so that AIX doesn't have this problem any more, but OpenJ9 still has the issue with 21.0.2, it will be resolved in 21.0.3.

So, what exact change is required in the following topic for release 0.43.0? https://eclipse.dev/openj9/docs/xxenabledynamicagentloading/

Confusion is because of this comment #1264 (comment)

@pshipton
Copy link
Member

pshipton commented Feb 6, 2024

Just add a note that the AIX problem will be fixed in the next release.

Sreekala-Gopakumar added a commit to Sreekala-Gopakumar/openj9-docs that referenced this issue Feb 6, 2024
eclipse-openj9#1264

Added a note in the existing topic -XX:[+|-]EnableDynamicAgentLoading that a fix to restrict the display of multiple warnings will be provided in a future release.

Closes eclipse-openj9#1264
Signed-off-by: Sreekala Gopakumar <sreekala.gopakumar@ibm.com>
@pshipton
Copy link
Member

pshipton commented Feb 8, 2024

Reopened and added to 0.44 milestone, to indicate the AIX problem has been resolved via eclipse-openj9/openj9#18881

@pshipton pshipton reopened this Feb 8, 2024
Sreekala-Gopakumar added a commit to Sreekala-Gopakumar/openj9-docs that referenced this issue Mar 4, 2024
eclipse-openj9#1264

Fix added to restrict display of multiple warnings on loading the same agent on AIX

Closes eclipse-openj9#1264
Signed-off-by: Sreekala Gopakumar <sreekala.gopakumar@ibm.com>
Sreekala-Gopakumar added a commit to Sreekala-Gopakumar/openj9-docs that referenced this issue Mar 4, 2024
eclipse-openj9#1264

Fix added to restrict display of multiple warnings on loading the same agent on AIX

Closes eclipse-openj9#1264
Signed-off-by: Sreekala Gopakumar <sreekala.gopakumar@ibm.com>
Sreekala-Gopakumar added a commit to Sreekala-Gopakumar/openj9-docs that referenced this issue Mar 4, 2024
eclipse-openj9#1264

Fix added to restrict display of multiple warnings on loading the same agent on AIX

Closes eclipse-openj9#1264
Signed-off-by: Sreekala Gopakumar <sreekala.gopakumar@ibm.com>
Sreekala-Gopakumar added a commit to Sreekala-Gopakumar/openj9-docs that referenced this issue Mar 4, 2024
eclipse-openj9#1264

Fix added to restrict display of multiple warnings on loading the same agent on AIX

Closes eclipse-openj9#1264
Signed-off-by: Sreekala Gopakumar <sreekala.gopakumar@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants