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

Deprecate JNI critical APIs

    XMLWordPrintable

Details

    • x86_64
    • linux

    Description

      A DESCRIPTION OF THE REQUEST :
      JNI criticals are complex enough that they have been broken in many Java releases when used with -Xcheck:jni:
      http://mail.openjdk.java.net/pipermail/hotspot-dev/2017-December/029523.html
      They are a source of time to safepoint (TTSP) issues described as a "silent killer":
      https://groups.google.com/d/msg/mechanical-sympathy/f3g8pry-o1A/x6NptTDslcIJ
      There is an assumption that they provide un-copied access to memory which the API doesn't guarantee.
      JVMs differ in how they are implemented meaning that performance guarantees don't exist, acquiring the critical lock may be a long pause for a JVM with a concurrent garbage collector running. Pinning may be a hard to measure cost in terms of memory fragmentation, cost to pin and GC overhead, etc.
      Discouraging their usage will encourage improvements to libraries to write code in Java and avoid needless JNI transitions for the sake of "a quick copy".

      JUSTIFICATION :
      Deprecating an API is a way of frowning upon its usage. JNI criticals have so many issues that their usage should be frowned upon.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Gradually code will migrate from JNI criticals to either safe alternatives, GetArrayElements, GetArrayRegion, or be rewritten in Java.
      ACTUAL -
      Users feel that JNI criticals are a magic O(1) performance backdoor that allows them to mix native and Java code without realizing the TTSP issues they are creating.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: