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

ArchiveHeapWriter::get_filler_size_at() cannot handle buffer expansion

    XMLWordPrintable

Details

    • b23

    Description

      Found during Leyden development as we have more objects in the CDS archive heap:

      Test case with JDK mainline:

      Change https://github.com/openjdk/jdk/blob/218829e0a2a3ae5599b81733df53557966392033/src/hotspot/share/cds/archiveHeapWriter.cpp#L171-L177 to

      void ArchiveHeapWriter::allocate_buffer() {
        int initial_buffer_size = 1050000; // WAS 100000;
        _buffer = new GrowableArrayCHeap<u1, mtClassShared>(initial_buffer_size);
        _buffer_used = 0;
        ensure_buffer_space(1); // so that buffer_bottom() works
      }

      Run with

      java -Xshare:dump -Xlog:cds+map*=trace:file=cds.map:none:filesize=0'

      # Internal Error (/jdk3/tea/open/src/hotspot/share/cds/archiveBuilder.cpp:1075), pid=310801, tid=310811
      # Error: ShouldNotReachHere()
      #
      # JRE version: Java(TM) SE Runtime Environment (22.0) (slowdebug build 22-internal-adhoc.iklam.tea)
      # Java VM: JavaHotSpot(TM) 64-Bit Server VM (slowdebug 22-internal-adhoc.iklam.tea, interpreted mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0x5c5781] ArchiveBuilder::CDSMapLogger::log_heap_region(ArchiveHeapInfo*)+0x1fe

      ===============================
      Reason:

      The archive heap size is about 1079504 bytes. A filler array was created just before we have allocated about 1MB objects. The address of this array is remembered in this table:

      typedef ResourceHashtable<address, size_t,
            127, // prime number
            AnyObj::C_HEAP,
            mtClassShared> FillersTable;

      However, as we allocate more than 1050000, the buffer is expanded, and the filler object now lives on a different address.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: