Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8258836

JNI local refs exceed capacity getDiagnosticCommandInfo

XMLWordPrintable

        $ cat MbeanServerTest.java
        public class MbeanServerTest {
        public static void main(String[] args) {
        System.out.println(java.lang.management.ManagementFactory.getPlatformMBeanServer());
        }
        }
        $ ./build/linux-x86_64-server-release/images/jdk/bin/javac MbeanServerTest.java
        $ ./build/linux-x86_64-server-release/images/jdk/bin/java -Xcheck:jni MbeanServerTest
        WARNING: JNI local refs: 33, exceeds capacity: 32
        at com.sun.management.internal.DiagnosticCommandImpl.getDiagnosticCommandInfo(jdk.management@17-internal/Native Method)
        at com.sun.management.internal.DiagnosticCommandImpl.getMBeanInfo(jdk.management@17-internal/DiagnosticCommandImpl.java:196)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getNewMBeanClassName(java.management@17-internal/DefaultMBeanServerInterceptor.java:329)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(java.management@17-internal/DefaultMBeanServerInterceptor.java:315)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(java.management@17-internal/JmxMBeanServer.java:522)
        at java.lang.management.ManagementFactory.lambda$addMXBean$7(java.management@17-internal/ManagementFactory.java:902)
        at java.lang.management.ManagementFactory$$Lambda$22/0x0000000801057180.run(java.management@17-internal/Unknown Source)
        at java.security.AccessController.executePrivileged(java.base@17-internal/AccessController.java:784)
        at java.security.AccessController.doPrivileged(java.base@17-internal/AccessController.java:554)
        at java.lang.management.ManagementFactory.addMXBean(java.management@17-internal/ManagementFactory.java:892)
        at java.lang.management.ManagementFactory.lambda$getPlatformMBeanServer$1(java.management@17-internal/ManagementFactory.java:488)
        at java.lang.management.ManagementFactory$$Lambda$21/0x00000008010569f8.accept(java.management@17-internal/Unknown Source)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(java.base@17-internal/ForEachOps.java:183)
        at java.util.Collections$2.tryAdvance(java.base@17-internal/Collections.java:4820)
        at java.util.Collections$2.forEachRemaining(java.base@17-internal/Collections.java:4828)
        at java.util.stream.ReferencePipeline$Head.forEach(java.base@17-internal/ReferencePipeline.java:762)
        at java.util.stream.ReferencePipeline$7$1.accept(java.base@17-internal/ReferencePipeline.java:276)
        at java.util.stream.ReferencePipeline$2$1.accept(java.base@17-internal/ReferencePipeline.java:179)
        at java.util.HashMap$ValueSpliterator.forEachRemaining(java.base@17-internal/HashMap.java:1766)
        at java.util.stream.AbstractPipeline.copyInto(java.base@17-internal/AbstractPipeline.java:484)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@17-internal/AbstractPipeline.java:474)
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(java.base@17-internal/ForEachOps.java:150)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(java.base@17-internal/ForEachOps.java:173)
        at java.util.stream.AbstractPipeline.evaluate(java.base@17-internal/AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.forEach(java.base@17-internal/ReferencePipeline.java:596)
        at java.lang.management.ManagementFactory.getPlatformMBeanServer(java.management@17-internal/ManagementFactory.java:488)
        - locked <0x000000062f019688> (a java.lang.Class for java.lang.management.ManagementFactory)
        at MbeanServerTest.main(MbeanServerTest.java:3)


        Looks like getDiagnosticCommandArgumentInfoArray() in src/jdk.management/share/native/libmanagement_ext/DiagnosticCommandImpl.c is leaking references.

              sgehwolf Severin Gehwolf
              sgehwolf Severin Gehwolf
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: