Skip to content

Conversation

@LantaoJin
Copy link
Member

@LantaoJin LantaoJin commented Aug 22, 2025

Description

#3983 enables GCedMemoryUsage for Calcite. But when the Java version is less than 21, there is no ConcurrentMXBean returned from ManagementFactory.getGarbageCollectorMXBeans(). Fallback it to RuntimeMemoryUsage.

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • New PPL command checklist all confirmed.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff or -s.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Lantao Jin <ltjin@amazon.com>
@LantaoJin LantaoJin added the bug Something isn't working label Aug 22, 2025
@LantaoJin
Copy link
Member Author

No need to backport to 2.19-dev. The fixing is included in #4105

Signed-off-by: Lantao Jin <ltjin@amazon.com>
private void registerGCListener() {
boolean registered = false;
List<GarbageCollectorMXBean> gcBeans = ManagementFactory.getGarbageCollectorMXBeans();
if (gcBeans.stream()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did we get runtime exception on 2.19-dev branch? Which JDK version this feature depend on?

Copy link
Member Author

Choose a reason for hiding this comment

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

Haven't backported to 2.19-dev. I am still working on backporting #4105. Then the JDK version < 20, there is no specific G1 Concurrent GC Monitoring registered, ref https://github.com/openjdk/jdk/blob/jdk-19-ga/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp#L91. From JDK 20, G1 Concurrent GC was registered in Monitoring, ref https://github.com/openjdk/jdk/blob/jdk-20-ga/src/hotspot/share/gc/g1/g1MonitoringSupport.cpp#L93.

This PR is to verify if there a Concurrent MXBean registered in JDK before initialing a GCedMemoryUsage.

Signed-off-by: Lantao Jin <ltjin@amazon.com>
@qianheng-aws qianheng-aws merged commit 9c09a02 into opensearch-project:main Aug 26, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants