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

Avoid CleanClassLoaderDataMetaspaces safepoints when previous versions are shared

XMLWordPrintable

    • b22

        When transforming/redefining classes a previous version list is linked together in the InstanceKlass if the original class is still used or shared. This difference between shared and used is not currently noted. This leads to a problem when doing concurrent class unloading, because during that we postpone some potential work to a safepoint (since we are not in one). This is the CleanClassLoaderDataMetaspaces and it is triggered by the ServiceThread if there is work to be done, for example if InstanceKlass::_has_previous_versions is true.

        Since we currently does not differentiate between shared and "in use" we always set _has_previous_versions if anything is on this list. This together with the fact that shared previous versions should never be cleaned out leads to this safepoint being triggered after every concurrent class unloading even though there is no work to be done.

        This can be avoided by making sure the _previous_versions list is only cleaned when there are non-shared classes on it.

              sjohanss Stefan Johansson
              sjohanss Stefan Johansson
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: