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

No memory overcommit protection for ZGC - Overcommit leads to crash of entire OS

XMLWordPrintable

    • gc
    • x86_64
    • linux

      ADDITIONAL SYSTEM INFORMATION :
      Tested on multiple Linux OSs, including Ubuntu running inside docker
      Affects at least jdk-17, jdk-18 and jdk-19

      A DESCRIPTION OF THE PROBLEM :
      Setting properties:
      "-XX:+UseZGC -Xms$TOOLARGE -Xmx$TOOLARGE"
      and starting anything with that runtime crashed the entire host OS, including if this is run inside of a docker container

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      #intentionally set TOOLARGE beyond the memory capacity of the host
      export TOOLARGE=40G

      echo -en "class HelloZGC {\n public static void main(String[] args) {\n System.out.println(\"Hello, oom\");\n }\n}\n" > zgc.java

      $JDK/bin/javac zgc.java
      $JDK/bin/java -XX:+UseZGC -Xms$TOOLARGE -Xmx$TOOLARGE HelloZGC

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Running the same procedure with for instance G1GC will result in the JVM refusing to start which seems like a sane default even if this is caused by an obvious configuration error
      ACTUAL -
      Entire host OS crashes

      ---------- BEGIN SOURCE ----------
      class HelloZGC {
          public static void main(String[] args) {
              System.out.println("Hello, oom");
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: