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

G1: HeapRegionSeq::shrink_by() has invalid assert

XMLWordPrintable

    • gc
    • b32

        The assert:

         assert(i > 0, "we should never remove all regions");

        in HeapRegionSeq::shrink_by() is incorrect. If we shrink the heap to only contain one region we hit this assert. The reason is that we first decrement the value of i and then check the assert just before we should exit the loop.

        So i == 0 actually means that we have one region left.

        Here's a reproducer, SysGC is only does System.gc():

        $ java -XX:+UseG1GC -XX:G1HeapRegionSize=8m -cp ~/tests/misc-tests/bin SysGC

        # To suppress the following error report, specify this argument
        # after -XX: or in .hotspotrc: SuppressErrorAt=/heapRegionSeq.cpp:239
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (/Users/brutisso/repos/hs-gc-g1-mmap/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp:239), pid=46207, tid=16643
        # assert(i > 0) failed: we should never remove all regions
        #
        # JRE version: Java(TM) SE Runtime Environment (8.0-b79) (build 1.8.0-ea-b79)
        # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.0-b27-internal-jvmg mixed mode bsd-amd64 compressed oops)
        # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
        #
        # An error report file with more information is saved as:
        # /Users/brutisso/repos/hs-gc-g1-mmap/hs_err_pid46207.log
        #
        # If you would like to submit a bug report, please visit:
        # http://bugreport.sun.com/bugreport/crash.jsp
        #
        Current thread is 16643
        Dumping core ...
        Abort trap: 6

              brutisso Bengt Rutisson (Inactive)
              brutisso Bengt Rutisson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: