JNI local refs exceeds capacity warning in NetworkInterface::getAll

Solution Verified - Updated -

Issue

Running the following snippet, with -Xcheck:jni VM argument, generates multiple warnings.

public class TestDiagnosticCommandImpl {
    public static void main(String[] args) {
        System.out.println(java.lang.management.ManagementFactory.getPlatformMBeanServer());
    }
}

The multiple warnings:

SIGTERM: [libjvm.so+0xc14f00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGQUIT: [libjvm.so+0xc14f00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
WARNING: JNI local refs: 33, exceeds capacity: 32
    at com.sun.management.internal.DiagnosticCommandImpl.getDiagnosticCommandInfo(jdk.management@11.0.8/Native Method)
    at com.sun.management.internal.DiagnosticCommandImpl.getMBeanInfo(jdk.management@11.0.8/DiagnosticCommandImpl.java:196)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getNewMBeanClassName(java.management@11.0.8/DefaultMBeanServerInterceptor.java:329)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(java.management@11.0.8/DefaultMBeanServerInterceptor.java:315)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(java.management@11.0.8/JmxMBeanServer.java:522)
    at java.lang.management.ManagementFactory.lambda$addMXBean$7(java.management@11.0.8/ManagementFactory.java:902)
    at java.lang.management.ManagementFactory$$Lambda$22/0x0000000840066c40.run(java.management@11.0.8/Unknown Source)
    at java.security.AccessController.doPrivileged(java.base@11.0.8/Native Method)
    at java.lang.management.ManagementFactory.addMXBean(java.management@11.0.8/ManagementFactory.java:892)
    at java.lang.management.ManagementFactory.lambda$getPlatformMBeanServer$1(java.management@11.0.8/ManagementFactory.java:488)
    at java.lang.management.ManagementFactory$$Lambda$21/0x0000000840066840.accept(java.management@11.0.8/Unknown Source)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(java.base@11.0.8/ForEachOps.java:183)
    at java.util.Collections$2.tryAdvance(java.base@11.0.8/Collections.java:4747)
    at java.util.Collections$2.forEachRemaining(java.base@11.0.8/Collections.java:4755)
    at java.util.stream.ReferencePipeline$Head.forEach(java.base@11.0.8/ReferencePipeline.java:658)
    at java.util.stream.ReferencePipeline$7$1.accept(java.base@11.0.8/ReferencePipeline.java:274)
    at java.util.stream.ReferencePipeline$2$1.accept(java.base@11.0.8/ReferencePipeline.java:177)
    at java.util.HashMap$ValueSpliterator.forEachRemaining(java.base@11.0.8/HashMap.java:1675)
    at java.util.stream.AbstractPipeline.copyInto(java.base@11.0.8/AbstractPipeline.java:484)
    at java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@11.0.8/AbstractPipeline.java:474)
    at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(java.base@11.0.8/ForEachOps.java:150)
    at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(java.base@11.0.8/ForEachOps.java:173)
    at java.util.stream.AbstractPipeline.evaluate(java.base@11.0.8/AbstractPipeline.java:234)
    at java.util.stream.ReferencePipeline.forEach(java.base@11.0.8/ReferencePipeline.java:497)
    at java.lang.management.ManagementFactory.getPlatformMBeanServer(java.management@11.0.8/ManagementFactory.java:488)
    - locked <0x00000000ff454400> (a java.lang.Class for java.lang.management.ManagementFactory)
    at test.TestDiagnosticCommandImpl.main(TestDiagnosticCommandImpl.java:6)
WARNING: JNI local refs: 66, exceeds capacity: 65

Environment

  • OpenJDK 8
  • OpenJDK 11

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In