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

SA should ignore archived java heap objects that are not in use

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 13
    • 12
    • hotspot
    • b10

      When archived java heap regions are mapped into a runtime jvm process, archived java objects become alive when they are in use. For example, when a shared class is loaded, its mirror object is materialized and becomes alive. When the class is initialized, its archived subgraphs are used. For the rest of the objects in the mapped archive heap regions, they are not live objects and stay as 'dormant'. They may not be in a 'consistent' state since their associated Klass may not be loaded yet. SA should ignore those objects when iterating java heap.

      Currently, the types of archived java objects are still limited. All archived objects' klasses are already loaded by the time SA walks java heap. With more object subgraphs are being archived, there will be java objects whose klasses are not yet loaded during SA heap iteration.

      With the JDK-8214712 change, the java/util/jar/Attributes$Name.KNOWN_NAMES subgraph is archived. Claes noticed following failure with open/test/hotspot/jtreg/serviceability/sa/TestHeapDumpForLargeArray.java when running the test with his change:

      jib > Exception in thread "main" sun.jvm.hotspot.utilities.AssertionFailure: can not get class data for java/util/jar/Attributes$Name0x00000008002779e0
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.utilities.Assert.that(Assert.java:32)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.writeInstance(HeapHprofBinWriter.java:949)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.utilities.AbstractHeapGraphWriter$1.doObj(AbstractHeapGraphWriter.java:95)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.oops.ObjectHeap.iterateLiveRegions(ObjectHeap.java:283)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.oops.ObjectHeap.iterate(ObjectHeap.java:101)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.utilities.AbstractHeapGraphWriter.write(AbstractHeapGraphWriter.java:51)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.utilities.HeapHprofBinWriter.write(HeapHprofBinWriter.java:443)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.writeHeapHprofBin(JMap.java:182)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.run(JMap.java:97)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.startInternal(Tool.java:260)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.start(Tool.java:223)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.tools.Tool.execute(Tool.java:118)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.tools.JMap.main(JMap.java:176)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.runJMAP(SALauncher.java:326)
      jib > at jdk.hotspot.agent/sun.jvm.hotspot.SALauncher.main(SALauncher.java:455)

      The java/util/jar/Attributes and java/util/jar/Attributes$Name classes are not used by the test, so they are not loaded and added to HeapHprofBinWriter.classDataCache map. The AssertionFailure is triggered when HeapHprofBinWriter.write() iterates heap and encounters the archived java/util/jar/Attributes$Name.KNOWN_NAMES.

            jgeorge Jini George (Inactive)
            jiangli Jiangli Zhou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: