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

Large NMethodSizeLimit triggers assert during C1 code buffer allocation

    XMLWordPrintable

Details

    • b25
    • generic
    • generic

    Description

      ### Failure analysis ###
      The failure occurs due to a cast from an unsigned to a signed integer, which results in an overflow.

      ### Original report ###
      A DESCRIPTION OF THE PROBLEM :
      The develop vm option NMethodSizeLimit can cause JVM crash if we set a big value for it, no matter the running test program.

      For example, for the following test program:

      ```java
      public class NMethodSizeLimitTest {
          public static void main(String[] args) {
              System.out.println("Success Loaded!");
          }
      }
      ```

      If we run this program on Ubuntu with OpenJDK11 using the following command:

      ```java
      pathTo/jdk11u/build/linux-x86_64-normal-server-fastdebug/jdk/bin/java -XX:NMethodSizeLimit=21474
      83647 -cp . NMethodSizeLimitTest
      ```

      The output of the above command is:

      ```java
      # To suppress the following error report, specify this argument
      # after -XX: or in .hotspotrc: SuppressErrorAt=/codeCache.cpp:487
      #
      # A fatal error has been detected by the Java Runtime Environment:
      #
      # Internal Error (/home/JVM/JVMs/LineCov/jdk11u/src/hotspot/share/code/codeCache.cpp:487), pid=3159, tid=3182
      # assert(size > 0) failed: Code cache allocation request must be > 0 but is -1932735136
      #
      # JRE version: OpenJDK Runtime Environment (11.0.21) (fastdebug build 11.0.21-internal+0-adhoc.root.jdk11u)
      # Java VM: OpenJDK 64-Bit Server VM (fastdebug 11.0.21-internal+0-adhoc.root.jdk11u, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
      # Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /home/tmp/core.3159)
      #
      # An error report file with more information is saved as:
      # /home/tmp/hs_err_pid3159.log
      #
      # Compiler replay data is saved as:
      # /home/tmp/replay_pid3159.log
      #
      # If you would like to submit a bug report, please visit:
      # https://bugreport.java.com/bugreport/crash.jsp
      #
      Current thread is 3182
      Dumping core ...
      Aborted (core dumped)
      ```

      Ubuntu Version:

      ```java
      NAME="Ubuntu"
      VERSION="18.04.5 LTS (Bionic Beaver)"
      ID=ubuntu
      ID_LIKE=debian
      PRETTY_NAME="Ubuntu 18.04.5 LTS"
      VERSION_ID="18.04"
      HOME_URL="https://www.ubuntu.com/"
      SUPPORT_URL="https://help.ubuntu.com/"
      BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
      PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
      VERSION_CODENAME=bionic
      UBUNTU_CODENAME=bionic
      ```

      Also, this will cause the JVM to crash on OpenJDK8.


      FREQUENCY : always


      Attachments

        Issue Links

          Activity

            People

              dlunden Daniel Lunden
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: