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

PrintSharedSpaces may crash when some blocks are freed and allocated again during -Xshare:dump

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • 9
    • 9
    • hotspot

    Description

      As of JDK8-b111, if -XX:+PrintSharedSpaces is specified during -Xshare:dump, in rare occasions, some arrays may be deallocated, and the space re-used later:

      #1 0x00007ffff71a9444 in Metaspace::deallocate (this=0x7ffff0035ce8, ptr=0x800009500, word_size=95,
          is_class=false) at /home/iklam/jdk/cds/src/share/vm/memory/metaspace.cpp:3176
      #2 0x00007ffff6d6dadc in MetadataFactory::free_array<Method*> (loader_data=0x7ffff0035b88, data=0x800009500)
          at /home/iklam/jdk/cds/src/share/vm/memory/metadataFactory.hpp:70
      #3 0x00007ffff6d6a8d5 in merge_in_new_methods (klass=0x80393ef10, new_methods=0x7ffff6715590, __the_thread__=
          0x7ffff000a000) at /home/iklam/jdk/cds/src/share/vm/classfile/defaultMethods.cpp:1092
      #4 0x00007ffff6d6a2fd in create_overpasses (slots=0x7ffff0012b58, klass=0x80393ef10,
          __the_thread__=0x7ffff000a000) at /home/iklam/jdk/cds/src/share/vm/classfile/defaultMethods.cpp:990
      #5 0x00007ffff6d6966f in DefaultMethods::generate_default_methods (klass=0x80393ef10, mirandas=0x7ffff67158f0,
          __the_thread__=0x7ffff000a000) at /home/iklam/jdk/cds/src/share/vm/classfile/defaultMethods.cpp:785
      #6 0x00007ffff6c94be4 in ClassFileParser::parseClassFile (this=0x7ffff6715dd0, name=0x800000240,
          loader_data=0x7ffff0035b88, protection_domain=..., host_klass=..., cp_patches=0x0, parsed_name=...,
          verify=false, __the_thread__=0x7ffff000a000)
          at /home/iklam/jdk/cds/src/share/vm/classfile/classFileParser.cpp:4088
      #7 0x00007ffff6ca27c3 in ClassFileParser::parseClassFile (this=0x7ffff6715dd0, name=0x800000240,
          loader_data=0x7ffff0035b88, protection_domain=..., parsed_name=..., verify=false,
          __the_thread__=0x7ffff000a000) at /home/iklam/jdk/cds/src/share/vm/classfile/classFileParser.hpp:468
      #8 0x00007ffff6ca0457 in ClassLoader::load_classfile (h_name=0x800000240, __the_thread__=0x7ffff000a000)
          at /home/iklam/jdk/cds/src/share/vm/classfile/classLoader.cpp:941
      #9 0x00007ffff736288d in SystemDictionary::load_instance_class (class_name=0x800000240, class_loader=...,
          __the_thread__=0x7ffff000a000) at /home/iklam/jdk/cds/src/share/vm/classfile/systemDictionary.cpp:1335
      #10 0x00007ffff736098c in SystemDictionary::resolve_instance_class_or_null (name=0x800000240, class_loader=...,
          protection_domain=..., __the_thread__=0x7ffff000a000)
          at /home/iklam/jdk/cds/src/share/vm/classfile/systemDictionary.cpp:779
      #11 0x00007ffff735f2b3 in SystemDictionary::resolve_or_null (class_name=0x800000240, class_loader=...,


      Metaspace::record_allocation doesn't consider the case where such deallocation/re-allocation may happen. As a result, -XX:+PrintSharedSpaces may crash here:

      DumpAllocClosure::dump_stats(...) {
        ...
        assert(all_ro_bytes == ro_all, "everything should have been counted"); << CRASH HERE
        assert(all_rw_bytes == rw_all, "everything should have been counted");

      }

      Attachments

        Issue Links

          Activity

            People

              iklam Ioi Lam
              iklam Ioi Lam
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: