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

jvm/heapAlloc/bytes not emitted when running Druid with JDK11+ #12312

Closed
FrankChen021 opened this issue Mar 6, 2022 · 0 comments · Fixed by #13068
Closed

jvm/heapAlloc/bytes not emitted when running Druid with JDK11+ #12312

FrankChen021 opened this issue Mar 6, 2022 · 0 comments · Fixed by #13068

Comments

@FrankChen021
Copy link
Member

#12232 officially support JDK11.

But by staring Druid with JDK11 with the example configuration, we can see an exception message as

2022-03-06T14:29:48,890 WARN [main] org.apache.druid.java.util.metrics.AllocationMetricCollectors - Cannot initialize org.apache.druid.java.util.metrics.AllocationMetricCollector
java.lang.reflect.InaccessibleObjectException: Unable to make public long[] com.sun.management.internal.HotSpotThreadImpl.getThreadAllocatedBytes(long[]) accessible: module jdk.management does not "exports com.sun.management.internal" to unnamed module @6d0b5baf
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340) ~[?:?]
        at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280) ~[?:?]
        at java.lang.reflect.Method.checkCanSetAccessible(Method.java:198) ~[?:?]
        at java.lang.reflect.Method.setAccessible(Method.java:192) ~[?:?]
        at org.apache.druid.java.util.metrics.AllocationMetricCollectors.<clinit>(AllocationMetricCollectors.java:41) [druid-core-0.23.0-SNAPSHOT.jar:0.23.0-SNAPSHOT]
        at org.apache.druid.java.util.metrics.JvmMonitor.<init>(JvmMonitor.java:79) [druid-core-0.23.0-SNAPSHOT.jar:0.23.0-SNAPSHOT]
        at org.apache.druid.java.util.metrics.JvmMonitor.<init>(JvmMonitor.java:70) [druid-core-0.23.0-SNAPSHOT.jar:0.23.0-SNAPSHOT]
        at org.apache.druid.java.util.metrics.JvmMonitor.<init>(JvmMonitor.java:65) [druid-core-0.23.0-SNAPSHOT.jar:0.23.0-SNAPSHOT]

Since AllocationMetricCollector is not correctly initialized, the metric jvm/heapAlloc/bytes is not emitted.

Solution

To fix this problem, we have to add following option to the JVM parameter

--add-exports jdk.management/com.sun.management.internal=ALL-UNNAMED

I think it's better for us to detect the JDK version and automatically add above option to the JVM parameter in the shell(node.sh/run-druid) if current JDK is JDK11+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant