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

C2: prevent elimination of unbalanced coarsened locking regions

XMLWordPrintable

    • b12

        ADDITIONAL SYSTEM INFORMATION :
        # JRE version: OpenJDK Runtime Environment (17.0.11) (fastdebug build 17.0.11-internal+0-adhoc.user.jdk17u-dev)
        # Java VM: OpenJDK 64-Bit Server VM (fastdebug 17.0.11-internal+0-adhoc.user.jdk17u-dev, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)

        A DESCRIPTION OF THE PROBLEM :
        Running the following test case with the fastdebug version of jdk17u-dev results in a crash without any additional options. This situation occurs approximately once in every 10 executions.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        java Test

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Runs normally and finishes within one second.
        ACTUAL -
        [0.375s][error][monitorinflation] ERROR: ObjectMonitor::exit(): thread=0x00007fc98c029930 is exiting an ObjectMonitor it does not own.
        [0.376s][error][monitorinflation] The imbalance is possibly caused by JNI locking.
        [0.376s][error][monitorinflation] (ObjectMonitor*) 0x00007fc98c6a48e0 = {
        [0.376s][error][monitorinflation] _header = 0x0000007f63425a01
        [0.376s][error][monitorinflation] _object = 0x0000000101f19200
        [0.376s][error][monitorinflation] _pad_buf0 = {
        [0.376s][error][monitorinflation] [0] = '\0'
        [0.376s][error][monitorinflation] ...
        [0.376s][error][monitorinflation] [47] = '\0'
        [0.376s][error][monitorinflation] }
        [0.376s][error][monitorinflation] _owner = 0x0000000000000000
        [0.376s][error][monitorinflation] _previous_owner_tid = 0
        [0.376s][error][monitorinflation] _pad_buf1 = {
        [0.376s][error][monitorinflation] [0] = '\0'
        [0.376s][error][monitorinflation] ...
        [0.376s][error][monitorinflation] [47] = '\0'
        [0.376s][error][monitorinflation] }
        [0.376s][error][monitorinflation] _next_om = 0x00007fc8e8000fd0
        [0.376s][error][monitorinflation] _recursions = 0
        [0.376s][error][monitorinflation] _EntryList = 0x0000000000000000
        [0.376s][error][monitorinflation] _cxq = 0x0000000000000000
        [0.376s][error][monitorinflation] _succ = 0x0000000000000000
        [0.376s][error][monitorinflation] _Responsible = 0x0000000000000000
        [0.376s][error][monitorinflation] _Spinner = 0
        [0.376s][error][monitorinflation] _SpinDuration = 5000
        [0.376s][error][monitorinflation] _contentions = 0
        [0.376s][error][monitorinflation] _WaitSet = 0x0000000000000000
        [0.376s][error][monitorinflation] _waiters = 0
        [0.376s][error][monitorinflation] _WaitSetLock = 0
        [0.376s][error][monitorinflation] }
        # To suppress the following error report, specify this argument
        # after -XX: or in .hotspotrc: SuppressErrorAt=/objectMonitor.cpp:1158
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (/data/user/jdk17u-dev/src/hotspot/share/runtime/objectMonitor.cpp:1158), pid=17712, tid=17713
        # assert(false) failed: Non-balanced monitor enter/exit!
        #
        # JRE version: OpenJDK Runtime Environment (17.0.11) (fastdebug build 17.0.11-internal+0-adhoc.xiezf.jdk17u-dev)
        # Java VM: OpenJDK 64-Bit Server VM (fastdebug 17.0.11-internal+0-adhoc.xiezf.jdk17u-dev, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
        # Problematic frame:
        # V [libjvm.so+0x138952f] ObjectMonitor::exit(JavaThread*, bool)+0x54f
        #
        # No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
        #
        # An error report file with more information is saved as:
        # /data/user/proj/toreport/Test2887_01_22_13_20_15/reduce/hs_err_pid17712.log
        #
        # If you would like to submit a bug report, please visit:
        # https://bugreport.java.com/bugreport/crash.jsp
        #


        ---------- BEGIN SOURCE ----------
        class Test {
           public static final int N = 256;
           public long instanceCount;
           static short sFld = 32330;

           static void vMeth() {
              short[] sArr = new short[N];
           }

           long lMeth(int i11, long l) {
              int i12;
              for (i12 = 1; 204 > i12; ++i12)
                 vMeth();
              long meth_res = i11;
              return meth_res;
           }

           static synchronized int method47(int var1, int var2) {
              return var1;
           }

           static synchronized int method71(int var) {
              return var;
           }

           boolean bMeth(int i2, int i3) {
              int i4;
              synchronized (Test.class) {
                 int i7 = 4;
                 int i8;
                 for (i4 = 5; i4 < 118; i4++)
                    for (i8 = 1; i8 < 5; i8++)
                       switch (63) {
                          case 63:
                             int var18 = 0;
                             while (var18 < 20000)
                                var18++;
                          case 64:
                             switch (48) {
                                case 48:
                                   sFld = (short) lMeth(i7, instanceCount);
                                case 50:
                                   for (int var27 = 2; var27 < 8; var27 += 2)
                                      for (int var28 = 1;;) {
                                         int var29 = method47(var27, var28);
                                         int var30 = var27 + method71(var28);
                                         break;
                                      }
                             }
                       }
                 long meth_res = i3;
                 return meth_res > 0;
              }
           }

           void mainTest(String[] strArr1) {
              int i1 = -9;
              for (int i = 0; i < 1000; ++i) {
                 if (bMeth(6, i1))
                    break;
              }
           }

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

        FREQUENCY : often


              kvn Vladimir Kozlov
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: