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

Excessive checked JNI warnings from Java startup

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
    • Subcomponent:
    • Introduced In Build:
      b16
    • Introduced In Version:
      9
    • Resolved In Build:
      b25
    • Verification:
      Not verified

      Backports

        Description

        Since adding preemptive warnings to JNI functions that have not previously checked for expections (JDK-8043224) running "-Xcheck:jni -version" produces numerous such warnings. E.g.:

        ...
        WARNING in native method: JNI call made without checking exceptions when required to from GetByteArrayRegion
        at java.lang.Object.getClass(Native Method)
        at java.lang.ClassLoader.<init>(ClassLoader.java:284)
        at java.lang.ClassLoader.<init>(ClassLoader.java:318)
        at java.security.SecureClassLoader.<init>(SecureClassLoader.java:76)
        at java.net.URLClassLoader.<init>(URLClassLoader.java:188)
        at sun.misc.Launcher$AppClassLoader.<init>(Launcher.java:292)
        at sun.misc.Launcher$AppClassLoader$1.run(Launcher.java:283)
        at sun.misc.Launcher$AppClassLoader$1.run(Launcher.java:279)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.misc.Launcher$AppClassLoader.getAppClassLoader(Launcher.java:278)
        at sun.misc.Launcher.<init>(Launcher.java:79)
        at sun.misc.Launcher.<clinit>(Launcher.java:57)
        at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1443)
        - locked <0x00000000d7000b08> (a java.lang.Class for java.lang.ClassLoader)
        at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1428)
        WARNING in native method: JNI call made without checking exceptions when required to from GetStringUTFRegion
        at java.lang.Object.getClass(Native Method)
        at java.lang.invoke.MethodHandleImpl.initStatics(MethodHandleImpl.java:51)
        at java.lang.invoke.MethodHandle.<clinit>(MethodHandle.java:426)

        Similarly, excessive local reference growth. E.g:
        ...
        WARNING: JNI local refs: 37, exceeds capacity: 34
                at java.lang.System.initProperties(Native Method)
                at java.lang.System.initializeSystemClass(System.java:1160)
        ...

        Two main causes:
        A) Early start up where checks make little to no sense.
          - Disable these warnings.
        B) Actual sloppy JNI code.
          - Identify and fix

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dsimms David Simms
                  Reporter:
                  dsimms David Simms
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: