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

Replace ClassLoader use of finalizer with phantom reference to unload native library

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 10
    • Fix Version/s: 10
    • Component/s: core-libs
    • Labels:

      Description

      This issue will track the work to convert ClassLoader finalizer to use phantom reference to unload native library.

      An earlier prototype uncovers an issue related to JNI_FindClass that is called during JNI_OnUnload that resurrects the caller class which has been GC'ed.

      I think JNI FindClass should not be called during JNI_OnUnload [1]. This would require further investigation, for example, whether it's possible to prohibit JNI_FindClass is called during JNI_OnUnload (to avoid resurrecting the caller's class). Also might be useful to gather some data to determine how high the compatibility risk is for JNI_FindClass not to work in JNI_OnUnload.

      1] https://bugs.openjdk.java.net/browse/JDK-4240589?focusedCommentId=13474512&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13474512

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mchung Mandy Chung
                Reporter:
                mchung Mandy Chung
              • Votes:
                1 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: