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

GVN Crash: assert() failed: correct memory chain

    XMLWordPrintable

Details

    • b26
    • 17
    • b04
    • x86_64
    • linux_ubuntu

    Backports

      Description

        ADDITIONAL SYSTEM INFORMATION :
        Arch: x86_64
        OS: Ubuntu 20.04.4 LTS
        HotSpot
        - openjdk version "17.0.5-internal" 2022-10-18
        - OpenJDK Runtime Environment (fastdebug build 17.0.5-internal+0-adhoc.simon.my-jdk17u)
        - OpenJDK 64-Bit Server VM (fastdebug build 17.0.5-internal+0-adhoc.simon.my-jdk17u, mixed mode, sharing)
        javac: javac 17.0.5-internal

        A DESCRIPTION OF THE PROBLEM :
        Note, this is found in OpenJDK 17.0.5 (internal; https://github.com/openjdk/jdk17u-dev; commit 041924ab).

        The following is part of the log:
        ```
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (/zdata/congli/my-jdk17u/src/hotspot/share/opto/memnode.cpp:226), pid=2320806, tid=2321039
        # assert(phase->C->get_alias_index(t) == phase->C->get_alias_index(t_adr)) failed: correct memory chain
        #
        # JRE version: OpenJDK Runtime Environment (17.0.5) (fastdebug build 17.0.5-internal+0-adhoc.congli.my-jdk17u)
        # Java VM: OpenJDK 64-Bit Server VM (fastdebug 17.0.5-internal+0-adhoc.congli.my-jdk17u, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
        # Problematic frame:
        # V [libjvm.so+0x14393eb] MemNode::optimize_memory_chain(Node*, TypePtr const*, Node*, PhaseGVN*)+0x1ab
        #
        # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
        #
        # If you would like to submit a bug report, please visit:
        # https://bugreport.java.com/bugreport/crash.jsp
        #

        --------------- S U M M A R Y ------------

        Command Line: -Xmx1G -Xbatch Test

        Host: amdsuplus3.inf.ethz.ch, AMD Ryzen Threadripper 3990X 64-Core Processor, 128 cores, 251G, Ubuntu 20.04.4 LTS
        Time: Thu Jun 9 18:31:10 2022 CEST elapsed time: 0.533573 seconds (0d 0h 0m 0s)

        --------------- T H R E A D ---------------

        Current thread (0x00007f93085e6e50): JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=2321039, stack(0x00007f92d33fc000,0x00007f92d34fd000)]


        Current CompileTask:
        C2: 533 53 % !b 4 Test::mainTest @ 152 (220 bytes)

        Stack: [0x00007f92d33fc000,0x00007f92d34fd000], sp=0x00007f92d34f8300, free space=1008k
        Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
        V [libjvm.so+0x14393eb] MemNode::optimize_memory_chain(Node*, TypePtr const*, Node*, PhaseGVN*)+0x1ab
        V [libjvm.so+0x1440ed3] LoadNode::Ideal(PhaseGVN*, bool)+0x313
        V [libjvm.so+0x1611818] PhaseIterGVN::transform_old(Node*)+0xb8
        V [libjvm.so+0x160a6de] PhaseIterGVN::optimize()+0x7e
        V [libjvm.so+0xa49319] Compile::Optimize()+0xa49
        V [libjvm.so+0xa4b1b6] Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)+0x1306
        V [libjvm.so+0x873806] C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x646
        V [libjvm.so+0xa5ce99] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x1029
        V [libjvm.so+0xa5dc88] CompileBroker::compiler_thread_loop()+0x678
        V [libjvm.so+0x1a0b846] JavaThread::thread_main_inner()+0x266
        V [libjvm.so+0x1a11a44] Thread::call_run()+0x104
        V [libjvm.so+0x158987c] thread_native_entry(Thread*)+0x10c
        ```

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. javac Test.java
        2. java -Xbatch -Xmx1G Test

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        No crashes
        ACTUAL -
        Crashed

        ---------- BEGIN SOURCE ----------
        class Test {
          int N;
          double[] dArrFld;
          int[] iArrFld;

          int iMeth() {
            double dArr[] = new double[N];
            long meth_res = Double.doubleToLongBits(checkSum(dArr));
            return (int) meth_res;
          }

          void mainTest(String[] strArr1) {
            int i = 47864, i27 = 0, i32, i37 = 39;
            short s4 = 21959;
            float f4;
            i ^= iMeth();
            for (; ; ) {
              for (i32 = 1; i32 < 46; i32++) i27 += s4;
              do
                for (f4 = 1; f4 < 1; ++f4) {
                  dArrFld[(int) f4] = 53586;
                  iArrFld[i37] *= 92.656F;
                  dArrFld = double1array(N, 2.89809);
                }
              while (++i37 < 46);
              for (int ax$5 = 4; ax$5 < 6167; )
                try {
                  long[] ax$3 = {1};
                  for (int ax$2 = 0; ax$2 < 100000; ) {
                    for (long duration : ax$3) {}
                    String ax$0 = "test";
                    ax$0 = ax$0 + ax$0;
                    ax$0 = ax$0 + ax$0;
                  }
                } catch (Throwable ax$4) {
                } finally {
                }
            }
          }

          public static void main(String[] strArr) {
            Test _instance = new Test();
            _instance.mainTest(strArr);
          }


          public static double checkSum(double[] a) {
            double sum = 0;
            for (int j = 0; j < a.length; j++) {
              sum += (a[j] / (j + 1) + a[j] % (j + 1));
            }
            return sum;
          }


          public static double[] double1array(int sz, double seed) {
            double[] ret = new double[sz];
            init(ret, seed);
            return ret;
          }


          public static void init(double[] a, double seed) {
            for (int j = 0; j < a.length; j++) {
              a[j] = (j % 2 == 0) ? seed + j : seed - j;
            }
          }
        }
        ---------- END SOURCE ----------

        FREQUENCY : always


        Attachments

          1. hotspot-bug-56.tar.gz
            60 kB
          2. Test.java
            1 kB
          3. Test-1.java
            0.9 kB

          Issue Links

            Activity

              People

                yyang Yi Yang
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: