-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P4
-
Affects Version/s: 16
-
Component/s: hotspot
VM asserts with "assert(false) failed: Attempting to acquire lock HandshakeState_lock/nosafepoint out of order with lock tty_lock/tty -- possible deadlock" when running with -XX:+DeoptimizeObjectsALot and -XX:+PrintIR
To replicate the issue just run some tests with the two flags, e.g. on the compiler/loopopts/superword folder, where it asserts just compiling a javac method.
make run-exploded-test TEST=test/hotspot/jtreg/compiler/loopopts/superword/ TEST_VM_OPTS="-XX:+DeoptimizeObjectsALot -XX:+PrintIR" CONF=-fastdebug
However, the issue can be triggered with a hello world program, i.e. any old Java program, the flags -XX:TieredStopAtLevel=3 -XX:+DeoptimizeObjectsALot -XX:+PrintIR and repeated execution until the test fails, which mostly happens after at most 100 repetitions.
The issue reproduces historically until the introduction of the -XX:+DeoptimizeOjectsALot in JDK16.
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (src/hotspot/share/runtime/mutex.cpp:460), pid=636925, tid=636977
# assert(false) failed: Attempting to acquire lock HandshakeState_lock/nosafepoint out of order with lock tty_lock/tty -- possible deadlock
#
# JRE version: Java(TM) SE Runtime Environment (27.0) (fastdebug build 27-internal-mhassig.open)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 27-internal-mhassig.open, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x1751e20] Mutex::check_rank(Thread*)+0x5a0
--------------- S U M M A R Y ------------
Command Line: -XX:TieredStopAtLevel=3 -XX:+DeoptimizeObjectsALot -XX:+PrintIR --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.SourceLauncher TestAnnotation.java
Current CompileTask:
C1:3487 893 3 java.lang.invoke.MethodTypeForm::canonicalize (74 bytes)
Stack: [0x00007f7a95cfe000,0x00007f7a95dfe000], sp=0x00007f7a95dfb7e0, free space=1013k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x1751e20] Mutex::check_rank(Thread*)+0x5a0 (mutex.cpp:460)
V [libjvm.so+0x1752b23] Mutex::try_lock()+0x53 (mutex.cpp:169)
V [libjvm.so+0x100295c] HandshakeState::has_operation(bool, bool)+0x2c (handshake.cpp:545)
V [libjvm.so+0x1127450] JavaThread::wait_for_object_deoptimization()+0x180 (safepointMechanism.inline.hpp:72)
V [libjvm.so+0xa5f96b] ThreadInVMfromNative::ThreadInVMfromNative(JavaThread*)+0xcb (safepointMechanism.inline.hpp:97)
V [libjvm.so+0xac75bd] ciSymbol::as_utf8()+0x7d (ciSymbol.cpp:55)
V [libjvm.so+0x8d8a02] InstructionPrinter::do_ProfileCall(ProfileCall*)+0x72 (c1_InstructionPrinter.cpp:826)
V [libjvm.so+0x8db4b4] InstructionPrinter::print_line(Instruction*)+0x144 (c1_InstructionPrinter.cpp:211)
V [libjvm.so+0x8d1c43] BlockBegin::print_block(InstructionPrinter&, bool)+0xc3 (c1_Instruction.cpp:878)
V [libjvm.so+0x8cfc20] BlockBegin::iterate_preorder(GrowableArray<bool>&, BlockClosure*)+0x70 (c1_Instruction.cpp:678)
V [libjvm.so+0x8cfccb] BlockBegin::iterate_preorder(GrowableArray<bool>&, BlockClosure*)+0x11b (c1_Instruction.cpp:681)
V [libjvm.so+0x8cfccb] BlockBegin::iterate_preorder(GrowableArray<bool>&, BlockClosure*)+0x11b (c1_Instruction.cpp:681)
V [libjvm.so+0x8cfccb] BlockBegin::iterate_preorder(GrowableArray<bool>&, BlockClosure*)+0x11b (c1_Instruction.cpp:681)
V [libjvm.so+0x8d4b75] BlockBegin::iterate_preorder(BlockClosure*)+0x125 (c1_Instruction.cpp:700)
V [libjvm.so+0x8c60a0] IR::print(bool, bool)+0xa0 (c1_IR.cpp:1252)
V [libjvm.so+0x893697] Compilation::build_hir() [clone .part.0]+0x2c7 (c1_Compilation.cpp:193)
V [libjvm.so+0x895738] Compilation::compile_java_method()+0x508 (c1_Compilation.cpp:372)
V [libjvm.so+0x895de6] Compilation::compile_method()+0x266 (c1_Compilation.cpp:471)
V [libjvm.so+0x896523] Compilation::Compilation(AbstractCompiler*, ciEnv*, ciMethod*, int, BufferBlob*, bool, DirectiveSet*)+0x363 (c1_Compilation.cpp:600)
V [libjvm.so+0x897f88] Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x208 (c1_Compiler.cpp:263)
V [libjvm.so+0xbc1ae0] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x780 (compileBroker.cpp:2345)
V [libjvm.so+0xbc3340] CompileBroker::compiler_thread_loop()+0x530 (compileBroker.cpp:1989)
V [libjvm.so+0x1128b9b] JavaThread::thread_main_inner()+0x13b (javaThread.cpp:776)
V [libjvm.so+0x1bb8b86] Thread::call_run()+0xb6 (thread.cpp:243)
V [libjvm.so+0x180ccf8] thread_native_entry(Thread*)+0x118 (os_linux.cpp:929)
To replicate the issue just run some tests with the two flags, e.g. on the compiler/loopopts/superword folder, where it asserts just compiling a javac method.
make run-exploded-test TEST=test/hotspot/jtreg/compiler/loopopts/superword/ TEST_VM_OPTS="-XX:+DeoptimizeObjectsALot -XX:+PrintIR" CONF=-fastdebug
However, the issue can be triggered with a hello world program, i.e. any old Java program, the flags -XX:TieredStopAtLevel=3 -XX:+DeoptimizeObjectsALot -XX:+PrintIR and repeated execution until the test fails, which mostly happens after at most 100 repetitions.
The issue reproduces historically until the introduction of the -XX:+DeoptimizeOjectsALot in JDK16.
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (src/hotspot/share/runtime/mutex.cpp:460), pid=636925, tid=636977
# assert(false) failed: Attempting to acquire lock HandshakeState_lock/nosafepoint out of order with lock tty_lock/tty -- possible deadlock
#
# JRE version: Java(TM) SE Runtime Environment (27.0) (fastdebug build 27-internal-mhassig.open)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 27-internal-mhassig.open, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0x1751e20] Mutex::check_rank(Thread*)+0x5a0
--------------- S U M M A R Y ------------
Command Line: -XX:TieredStopAtLevel=3 -XX:+DeoptimizeObjectsALot -XX:+PrintIR --add-modules=ALL-DEFAULT jdk.compiler/com.sun.tools.javac.launcher.SourceLauncher TestAnnotation.java
Current CompileTask:
C1:3487 893 3 java.lang.invoke.MethodTypeForm::canonicalize (74 bytes)
Stack: [0x00007f7a95cfe000,0x00007f7a95dfe000], sp=0x00007f7a95dfb7e0, free space=1013k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0x1751e20] Mutex::check_rank(Thread*)+0x5a0 (mutex.cpp:460)
V [libjvm.so+0x1752b23] Mutex::try_lock()+0x53 (mutex.cpp:169)
V [libjvm.so+0x100295c] HandshakeState::has_operation(bool, bool)+0x2c (handshake.cpp:545)
V [libjvm.so+0x1127450] JavaThread::wait_for_object_deoptimization()+0x180 (safepointMechanism.inline.hpp:72)
V [libjvm.so+0xa5f96b] ThreadInVMfromNative::ThreadInVMfromNative(JavaThread*)+0xcb (safepointMechanism.inline.hpp:97)
V [libjvm.so+0xac75bd] ciSymbol::as_utf8()+0x7d (ciSymbol.cpp:55)
V [libjvm.so+0x8d8a02] InstructionPrinter::do_ProfileCall(ProfileCall*)+0x72 (c1_InstructionPrinter.cpp:826)
V [libjvm.so+0x8db4b4] InstructionPrinter::print_line(Instruction*)+0x144 (c1_InstructionPrinter.cpp:211)
V [libjvm.so+0x8d1c43] BlockBegin::print_block(InstructionPrinter&, bool)+0xc3 (c1_Instruction.cpp:878)
V [libjvm.so+0x8cfc20] BlockBegin::iterate_preorder(GrowableArray<bool>&, BlockClosure*)+0x70 (c1_Instruction.cpp:678)
V [libjvm.so+0x8cfccb] BlockBegin::iterate_preorder(GrowableArray<bool>&, BlockClosure*)+0x11b (c1_Instruction.cpp:681)
V [libjvm.so+0x8cfccb] BlockBegin::iterate_preorder(GrowableArray<bool>&, BlockClosure*)+0x11b (c1_Instruction.cpp:681)
V [libjvm.so+0x8cfccb] BlockBegin::iterate_preorder(GrowableArray<bool>&, BlockClosure*)+0x11b (c1_Instruction.cpp:681)
V [libjvm.so+0x8d4b75] BlockBegin::iterate_preorder(BlockClosure*)+0x125 (c1_Instruction.cpp:700)
V [libjvm.so+0x8c60a0] IR::print(bool, bool)+0xa0 (c1_IR.cpp:1252)
V [libjvm.so+0x893697] Compilation::build_hir() [clone .part.0]+0x2c7 (c1_Compilation.cpp:193)
V [libjvm.so+0x895738] Compilation::compile_java_method()+0x508 (c1_Compilation.cpp:372)
V [libjvm.so+0x895de6] Compilation::compile_method()+0x266 (c1_Compilation.cpp:471)
V [libjvm.so+0x896523] Compilation::Compilation(AbstractCompiler*, ciEnv*, ciMethod*, int, BufferBlob*, bool, DirectiveSet*)+0x363 (c1_Compilation.cpp:600)
V [libjvm.so+0x897f88] Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x208 (c1_Compiler.cpp:263)
V [libjvm.so+0xbc1ae0] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x780 (compileBroker.cpp:2345)
V [libjvm.so+0xbc3340] CompileBroker::compiler_thread_loop()+0x530 (compileBroker.cpp:1989)
V [libjvm.so+0x1128b9b] JavaThread::thread_main_inner()+0x13b (javaThread.cpp:776)
V [libjvm.so+0x1bb8b86] Thread::call_run()+0xb6 (thread.cpp:243)
V [libjvm.so+0x180ccf8] thread_native_entry(Thread*)+0x118 (os_linux.cpp:929)