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

ClassLoaderDataGraph::unload_list_contains() is wrong

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 11
    • 11
    • hotspot
    • None
    • b10

    Description

      When working on some metaspace-related cleanup tasks, I saw that ClassLoaderDataGraph::unload_list_contains() seems wrong:

        for (ClassLoaderData* cld = _unloading; cld != NULL; cld = cld->next()) {
          if (cld->metaspace_or_null() != NULL && cld->metaspace_or_null()->contains(x)) {
            return true;
          }
        }

      There is no non-static Metaspace::contains. There are only two variants of static Metaspace::contains(), which test if the given pointer is somewhere in the metaspace, disregarding the classloader in question.

      In this case, this static function is called via an instance, which unfortunately is valid C++.

      This effects HeapRegion::verify:

              bool is_metaspace_object = Metaspace::contains(klass) ||
                                         (vo == VerifyOption_G1UsePrevMarking &&
                                         ClassLoaderDataGraph::unload_list_contains(klass));

      because ClassLoaderDataGraph::unload_list_contains(klass) returns true for any klass living in metaspace, not just klass objects which are part of this class loaders unload list.

      Although I am not sure I even understand the conditions: "Metaspace::contains(klass)" should always encompass "ClassLoaderDataGraph::unload_list_contains(klass)", or?

      Attachments

        Activity

          People

            coleenp Coleen Phillimore
            stuefe Thomas Stuefe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: