[TESTBUG] TestG1ClassUnloadingHWM.java could fail with large G1HeapRegionSize and small InitialHeapSize

XMLWordPrintable

    • gc

      After JDK-8373023 removed the default InitialRAMPercentage, hotspot/jtreg/gc/class_unloading/TestG1ClassUnloadingHWM.java could fail with -XX:G1HeapRegionSize=32m or larger region sizes.

      Example:
      STDERR:
       stdout: [[0.004s][info][gc] Using G1
      [0.040s][info][gc] GC(0) Pause Full (Metadata GC Threshold) 1M->1M(96M) 3.964ms
      [0.046s][info][gc] GC(1) Pause Full (Metadata GC Threshold) 1M->1M(96M) 4.901ms
      [0.050s][info][gc] GC(2) Pause Full (Metadata GC Threshold) 1M->1M(96M) 2.193ms
      [0.056s][info][gc] GC(3) Pause Young (Concurrent Start) (G1 Evacuation Pause) 33M->1M(128M) 0.964ms
      [0.056s][info][gc] GC(4) Concurrent Mark Cycle
      [0.058s][info][gc] GC(4) Pause Remark 31M->31M(128M) 0.208ms
      [0.059s][info][gc] GC(5) Pause Young (Normal) (G1 Evacuation Pause) 33M->1M(128M) 0.490ms
      [0.059s][info][gc] GC(4) Pause Cleanup 2M->2M(128M) 0.028ms
      [0.060s][info][gc] GC(4) Concurrent Mark Cycle 3.410ms
      ];
       stderr: []
       exitValue = 0

      java.lang.RuntimeException: '.*Pause Young \(Concurrent Start\).*' found in stdout: '[0.056s][info][gc] GC(3) Pause Young (Concurrent Start) (G1 Evacuation Pause) 33M->1M(128M) 0.964ms'
              at jdk.test.lib.process.OutputAnalyzer.shouldNotMatch(OutputAnalyzer.java:459)
              at gc.class_unloading.TestG1ClassUnloadingHWM.testWithoutG1ClassUnloading(TestG1ClassUnloadingHWM.java:76)
              at gc.class_unloading.TestG1ClassUnloadingHWM.main(TestG1ClassUnloadingHWM.java:89)
              at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
              at java.base/java.lang.reflect.Method.invoke(Method.java:565)
              at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:335)
              at java.base/java.lang.Thread.run(Thread.java:1516)


      Triggering concurrent cycles is probably an expected behavior when InitialHeapSize is small and G1HeapRegionSize is large. The test can actually pass with G1HeapRegionSize=16m, and 16M is G1's default maximum G1HeapRegionSize (because Xmx is by default capped at ~32G). Thus the test does not fail in the default settings.

      I propose explicitly setting -XX:G1HeapRegionSize to a small value for this test, so it is more robust in various configurations, such as those with a large G1HeapRegionSize.

            Assignee:
            Man Cao
            Reporter:
            Man Cao
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: