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

release _object in ObjectMonitor dtor to avoid races

XMLWordPrintable

    • b26
    • x86_64
    • linux
    • Verified

        The following stress test failed in my jdk-22+21 stress testing run:

        StressWrapper_SetNameAtExit.java

        which is a wrapper around the following test:

        runtime/Thread/SetNameAtExit.java

        Here's a snippet from the log file:

        #section:main
        ----------messages:(6/341)----------
        command: main -XX:+HeapDumpOnOutOfMemoryError -Xmx128m SetNameAtExit 6646
        reason: User specified action: run main/othervm/timeout=6946 -XX:+HeapDumpOnOutOfMemoryError -Xmx128m SetNameAtExit 6646
        started: Sat Oct 28 04:05:29 EDT 2023
        Mode: othervm [/othervm specified]
        finished: Sat Oct 28 04:48:23 EDT 2023
        elapsed time (seconds): 2574.554
        ----------configuration:(0/0)----------
        ----------System.out:(18/1156)----------
        About to execute for 6646 seconds.
        #
        # A fatal error has been detected by the Java Runtime Environment:
        #
        # Internal Error (/System/Volumes/Data/work/shared/bug_hunt/thread_SMR_stress/jdk22_exp.git/open/src/hotspot/share/oops/weakHandle.inline.hpp:38), pid=49774, tid=24579
        # assert(!is_null()) failed: Must be created
        #
        # JRE version: Java(TM) SE Runtime Environment (22.0) (slowdebug build 22-internal-2023-10-26-1411081.dcubed...)
        # Java VM: Java HotSpot(TM) 64-Bit Server VM (slowdebug 22-internal-2023-10-26-1411081.dcubed..., mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
        # Core dump will be written. Default location: ../core.49774
        #
        # An error report file with more information is saved as:
        # /System/Volumes/Data/work/shared/bug_hunt/thread_SMR_stress/jdk22_exp.git/build/macosx-aarch64-normal-server-slowdebug/test-support/jtreg_open_test_hotspot_jtreg_StressWrapper_SetNameAtExit_java/StressWrapper_SetNameAtExit/hs_err_pid49774.log
        [2565.454s][warning][os] Loading hsdis library failed
        #
        # If you would like to submit a bug report, please visit:
        # https://bugreport.java.com/bugreport/crash.jsp
        #
        ----------System.err:(0/0)----------
        ----------rerun:(35/5474)*----------

        and here's the crashing thread's stack:

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

        Current thread (0x000000012e811a10): JavaThread "MainThread" [_thread_in_Java, id=24579, stack(0x00000001717b4000,0x00000001719b7000) (2060K)]

        Stack: [0x00000001717b4000,0x00000001719b7000], sp=0x00000001719b5d00, free space=2055k
        Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
        V [libjvm.dylib+0x128b66c] VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x93c (weakHandle.inline.hpp:38)
        V [libjvm.dylib+0x128bd04] VMError::report_and_die(Thread*, char const*, int, unsigned long, VMErrorType, char const*, char*)+0x0
        V [libjvm.dylib+0x62cef4] print_error_for_unit_test(char const*, char const*, char*)+0x0
        V [libjvm.dylib+0x523da8] WeakHandle::peek() const+0x58
        V [libjvm.dylib+0xf2eec4] ObjectMonitor::object_peek() const+0x3c
        V [libjvm.dylib+0x117ca24] ObjectSynchronizer::quick_enter(oopDesc*, JavaThread*, BasicLock*)+0x100
        V [libjvm.dylib+0x1094314] SharedRuntime::monitor_enter_helper(oopDesc*, BasicLock*, JavaThread*)+0x34
        V [libjvm.dylib+0x10944d4] SharedRuntime::complete_monitor_locking_C(oopDesc*, BasicLock*, JavaThread*)+0xa0
        Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
        v ~RuntimeStub::_complete_monitor_locking_Java 0x0000000116ae2494
        J 295% c2 SetNameAtExit.main([Ljava/lang/String;)V (247 bytes) @ 0x0000000116f977fc [0x0000000116f94d00+0x0000000000002afc]
        j java.lang.invoke.LambdaForm$DMH+0x0000024001002000.invokeStatic(Ljava/lang/Object;Ljava/lang/Object;)V+10 java.base@22-internal
        j java.lang.invoke.LambdaForm$MH+0x0000024001003400.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+33 java.base@22-internal
        j java.lang.invoke.Invokers$Holder.invokeExact_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;+20 java.base@22-internal
        j jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+55 java.base@22-internal
        j jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+23 java.base@22-internal
        j java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;+102 java.base@22-internal
        j com.sun.javatest.regtest.agent.MainWrapper$MainTask.run()V+134
        j java.lang.Thread.runWith(Ljava/lang/Object;Ljava/lang/Runnable;)V+5 java.base@22-internal
        j java.lang.Thread.run()V+19 java.base@22-internal
        v ~StubRoutines::call_stub 0x00000001169d417c
        Lock stack of current Java thread (top to bottom):
        <empty>

        The test failed in a single slowdebug config so in 1 of 9 runs during
        the jdk-22+21 stress testing cycle.

              pchilanomate Patricio Chilano Mateo
              dcubed Daniel Daugherty
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

                Created:
                Updated:
                Resolved: