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

HotSpot JVM crash on null MethodHandle.invokeExact() in JDK 8

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      wsl2-ubuntu 22.04
      Linux 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

      java version "1.8.0_451"
      Java(TM) SE Runtime Environment (build 1.8.0_451-b10)
      Java HotSpot(TM) 64-Bit Server VM (build 25.451-b10, mixed mode)

      A DESCRIPTION OF THE PROBLEM :
      The following test program will crash the java runtime environment in JDK 8. However, it executes normally in JDK 11, 17 and 21.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      ```
      javac Test.java
      java Test
      ```

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The program should exit normally.
      ACTUAL -
      The program crashes. with following message:
      ```
      #
      [thread 140320781121088 also had an error]# A fatal error has been detected by the Java Runtime Environment:

      #
      # SIGSEGV (0xb) at pc=0x00007f9efaa03329, pid=20157, tid=0x00007f9eb52d3640
      #
      # JRE version: Java(TM) SE Runtime Environment (8.0_451) (build 1.8.0_451-b10)
      # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.451-b10 mixed mode linux-amd64 compressed oops)
      # Problematic frame:
      # V [libjvm.so+0x418329] ciMethodHandle::get_vmtarget() const+0xa9
      #
      # Core dump written. Default location: Core dumps may be processed with "/wsl-capture-crash %t %E %p %s" (or dumping to
      [...]

      Aborted (core dumped)
      ```

      ---------- BEGIN SOURCE ----------
      public class Test {
          public static void main(String[] args) {
              for (int i = 0; i < 100000; i++) {
                  func();
              }
          }
          public static void func() {
              java.lang.invoke.MethodHandle methodHandle = null;
              try {
                  methodHandle.invokeExact((byte) 0);
              } catch (Throwable t) {
              }
          }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            eaymane EL Haimer Aymane
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: