Skip to content

Support HotSpotDiagnosticMXBean in OpenJ9 JDK21+ - #17709

Merged
pshipton merged 1 commit into
eclipse-openj9:masterfrom
babsingh:support_HotSpotDiagnosticMXBean
Jun 30, 2023
Merged

Support HotSpotDiagnosticMXBean in OpenJ9 JDK21+#17709
pshipton merged 1 commit into
eclipse-openj9:masterfrom
babsingh:support_HotSpotDiagnosticMXBean

Conversation

@babsingh

Copy link
Copy Markdown
Contributor

This will allow us to enable a JTReg test for Structured Concurrency.

JTReg test: StructuredTaskScope/StructuredThreadDumpTest

Related: #17634

@babsingh

Copy link
Copy Markdown
Contributor Author

@pshipton @tajila I verified that StructuredThreadDumpTest passes with this change. Also, I didn't observe any side-effects of this change in personal builds. Can one of you please review these changes?

@pshipton

Copy link
Copy Markdown
Member

It seems this will enable other HotSpotDiagnosticMXBean APIs which aren't going to work on OpenJ9. What happens when they are called? We may need to do something so they fail gracefully, such as throw an appropriate exception.

https://download.java.net/java/early_access/jdk21/docs/api/jdk.management/com/sun/management/HotSpotDiagnosticMXBean.html

getDiagnosticOptions()
getVMOption()
setVMOption()

@tajila

tajila commented Jun 29, 2023

Copy link
Copy Markdown
Contributor

Does the use of HotSpotDiagnosticMXBean require -XX:+UnlockDiagnosticVMOptions on hotspot?

@babsingh

Copy link
Copy Markdown
Contributor Author

It seems this will enable other HotSpotDiagnosticMXBean APIs which aren't going to work on OpenJ9. What happens when they are called? We may need to do something so they fail gracefully, such as throw an appropriate exception.

https://download.java.net/java/early_access/jdk21/docs/api/jdk.management/com/sun/management/HotSpotDiagnosticMXBean.html

getDiagnosticOptions() getVMOption() setVMOption()

Initially, I thought it was only Java code. After running some JTReg tests, these methods also rely upon native methods which are not implemented in OpenJ9. So, I will add an override similar to dumpHeap, which will throw an UnsupportedOperationException.

@babsingh

Copy link
Copy Markdown
Contributor Author

Does the use of HotSpotDiagnosticMXBean require -XX:+UnlockDiagnosticVMOptions on hotspot?

I don't believe that it requires -XX:+UnlockDiagnosticVMOptions. StructuredThreadDumpTest uses HotSpotDiagnosticMXBean without -XX:+UnlockDiagnosticVMOptions.

@babsingh
babsingh force-pushed the support_HotSpotDiagnosticMXBean branch 2 times, most recently from 4dd830d to 46460ea Compare June 29, 2023 17:21
@babsingh

Copy link
Copy Markdown
Contributor Author

All feedback comments have been addressed.

@babsingh
babsingh force-pushed the support_HotSpotDiagnosticMXBean branch from 46460ea to 3c5d345 Compare June 29, 2023 21:08
@babsingh

Copy link
Copy Markdown
Contributor Author

Previous feedback has been addressed: removed the module check and added error handling as per the Javadoc.

@pshipton

Copy link
Copy Markdown
Member

What test suite(s) did you run already?

@babsingh
babsingh force-pushed the support_HotSpotDiagnosticMXBean branch from 3c5d345 to 5daea5b Compare June 29, 2023 21:44
@babsingh

babsingh commented Jun 29, 2023

Copy link
Copy Markdown
Contributor Author

What test suite(s) did you run already?

JDK21: sanity.functional,sanity.openjdk,extended.openjdk. JDK21 personal build: https://hyc-runtimes-jenkins.swg-devops.com/view/OpenJ9%20-%20Personal/job/Pipeline-Build-Test-Personal/17143/

JDK17: sanity.functional. JDK17 personal build: https://hyc-runtimes-jenkins.swg-devops.com/view/OpenJ9%20-%20Personal/job/Pipeline-Build-Test-Personal/17144/

Ran the disabled test locally.

Also, accounted for the recent feedback: an empty list is returned and exception messages have been updated.

@pshipton

Copy link
Copy Markdown
Member

jenkins test extended amac jdk11,jdk21

This will allow us to enable a JTReg test for Structured Concurrency.

JTReg test: StructuredTaskScope/StructuredThreadDumpTest

Related: eclipse-openj9#17634

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
@babsingh
babsingh force-pushed the support_HotSpotDiagnosticMXBean branch from 5daea5b to 346a572 Compare June 30, 2023 13:54
@babsingh

babsingh commented Jun 30, 2023

Copy link
Copy Markdown
Contributor Author

Old PR builds: https://openj9-jenkins.osuosl.org/job/PullRequest-OpenJ9/4025/. No issues seen during local testing with the latest changes.

@pshipton
pshipton merged commit 2ea9da2 into eclipse-openj9:master Jun 30, 2023
Comment on lines -773 to -775
create(OPENJ9_DIAGNOSTICS_MXBEAN_NAME, openj9.lang.management.internal.OpenJ9DiagnosticsMXBeanImpl.getInstance())
.addInterface(openj9.lang.management.OpenJ9DiagnosticsMXBean.class)
.validateAndRegister();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please help me understand why this was removed. This code is specific to Java 8 where there's no possibility that OpenJ9DiagnosticsMXBeanImpl.getInstance() might return null (even though the code would properly handle that situation). Why do we no longer want this bean to be registered?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah good catch, I missed it was specific to 8 (and we didn't test 8). So we need to add it back and add the HotspotBean there too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Opened #17726 to readd the registration calls.

babsingh added a commit to babsingh/openj9 that referenced this pull request Jun 30, 2023
The registration call was removed in eclipse-openj9#17709 due to a
false assumption. It has been added back since it is still required.

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
babsingh added a commit to babsingh/aqa-tests that referenced this pull request Jul 6, 2023
eclipse-openj9/openj9#17709 adds the required support to enable
StructuredThreadDumpTest.

Related issues which can be closed after the test is enabled:
- eclipse-openj9/openj9#17634
- eclipse-openj9/openj9#15278

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
llxia pushed a commit to adoptium/aqa-tests that referenced this pull request Jul 6, 2023
eclipse-openj9/openj9#17709 adds the required support to enable
StructuredThreadDumpTest.

Related issues which can be closed after the test is enabled:
- eclipse-openj9/openj9#17634
- eclipse-openj9/openj9#15278

Signed-off-by: Babneet Singh <sbabneet@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants