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

assert(InitialHeapSize >= MinHeapSize) failed: Ergonomics decided on incompatible initial and minimum heap sizes

    XMLWordPrintable

    Details

    • Subcomponent:
      gc
    • Resolved In Build:
      b28

      Description

      * Symptom
      ```
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/home/jdk/src/hotspot/share/gc/shared/gcArguments.cpp:96), pid=65831, tid=65832
      # assert(InitialHeapSize >= MinHeapSize) failed: Ergonomics decided on incompatible initial and minimum heap sizes
      #
      # JRE version: (16.0+4) (fastdebug build )
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 16-internal+4-adhoc.jvm.jdk, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
      # Problematic frame:
      # V [libjvm.so+0xd21c2f] GCArguments::assert_size_info()+0xff
      #


      Stack: [0x00007f6504652000,0x00007f6504753000], sp=0x00007f6504751b10, free space=1022k
      Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
      V [libjvm.so+0xd21c2f] GCArguments::assert_size_info()+0xff
      V [libjvm.so+0x1a6e02a] universe_init()+0x9a
      V [libjvm.so+0xe3685b] init_globals()+0x3b
      V [libjvm.so+0x1a20dc1] Threads::create_vm(JavaVMInitArgs*, bool*)+0x2a1
      V [libjvm.so+0xfc7a5c] JNI_CreateJavaVM+0x9c
      C [libjli.so+0x46b1] JavaMain+0xa1
      C [libjli.so+0x80bd] ThreadJavaMain+0xd
      ```

      * Reproduce (Two steps on linux)
      ```
      1. ulimit -v 8388608
      2. java -XX:MinHeapSize=5g -version
      ```

      * Proposed fix
      ```
      diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
      index 357b7e7e3a8..0a8e887858c 100644
      --- a/src/hotspot/share/runtime/arguments.cpp
      +++ b/src/hotspot/share/runtime/arguments.cpp
      @@ -1906,7 +1906,7 @@ void Arguments::set_heap_size() {

             reasonable_initial = limit_by_allocatable_memory(reasonable_initial);

      - FLAG_SET_ERGO(InitialHeapSize, (size_t)reasonable_initial);
      + FLAG_SET_ERGO(InitialHeapSize, MAX2((size_t)reasonable_initial, MinHeapSize));
             log_trace(gc, heap)(" Initial heap size " SIZE_FORMAT, InitialHeapSize);
           }
           // If the minimum heap size has not been set (via -Xms or -XX:MinHeapSize),
      ```

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jiefu Jie Fu
              Reporter:
              jiefu Jie Fu
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: