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

JMapHeapConfigTest.java doesn't work with negative jlong values

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 22
    • 14
    • hotspot
    • b13

      The test tries to match -XX:+PrintFlagsFinal with the output of jhsdb -jmap --pid <pid> --heap. This fails when running ZGC, which leaves the MaxNewSize set to (size_t)-1.

      $ ../build/fastdebug/jdk/bin/jhsdb jmap --pid 1550 --heap
      Attaching to process ID 1550, please wait...
      Debugger attached successfully.
      Server compiler detected.
      JVM version is 15-internal+0-2020-01-20-0958066.stefank...

      using thread-local object allocation.
      ZGC with 20 thread(s)

      Heap Configuration:
         MinHeapFreeRatio = 40
         MaxHeapFreeRatio = 70
         MaxHeapSize = 32210157568 (30718.0MB)
         NewSize = 1363144 (1.2999954223632812MB)
         MaxNewSize = 17592186044415 MB
         OldSize = 5452592 (5.1999969482421875MB)
         NewRatio = 2
         SurvivorRatio = 8
         MetaspaceSize = 21807104 (20.796875MB)
         CompressedClassSpaceSize = 1073741824 (1024.0MB)
         MaxMetaspaceSize = 17592186044415 MB
         G1HeapRegionSize = 0 (0.0MB)

      and:
      $ ../build/fastdebug/jdk/bin/java -XX:+PrintFlagsFinal -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -cp /localhome/tests/ HelloSleep 2>&1 | grep MaxNewSize
         size_t MaxNewSize = 18446744073709551615 {product} {default}

      HeapSummary.printValMB looks like this:
         private static final double FACTOR = 1024*1024;
         private void printValMB(String title, long value) {
            if (value < 0) {
              System.out.println(alignment + title + (value >>> 20) + " MB");
            } else {
              double mb = value/FACTOR;
              System.out.println(alignment + title + value + " (" + mb + "MB)");
            }
         }

      And when the value is negative we get a line that looks like this:
      MaxNewSize = 17592186044415 MB

      The test then tries to compare 17592186044415 with 18446744073709551615.

      Repro:
      make -C ../build/fastdebug test TEST=sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java JTREG="VM_OPTIONS=-XX:+UnlockExperimentalVMOptions -XX:+UseZGC"

            cjplummer Chris Plummer
            stefank Stefan Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: