RFR: 8313202: MutexLocker should disallow null Mutexes [v5]
Aleksey Shipilev
shade at openjdk.org
Mon Sep 4 19:14:38 UTC 2023
On Mon, 4 Sep 2023 09:38:09 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/hotspot/share/code/stubs.cpp line 241:
>>
>>> 239:
>>> 240: void StubQueue::print() {
>>> 241: ConditionalMutexLocker lock(_mutex, _mutex != nullptr, Mutex::_no_safepoint_check_flag);
>>
>> Why is this one now a `ConditionalMutexLocker`?
>
> I think there was a test failure that indicated we enter here from some error path? Let me reproduce it again.
Got one: `vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/TestDescription.java`.
The reproducer is as simple as:
% build/macosx-aarch64-server-fastdebug/images/jdk/bin/java -XX:+PrintInterpreter
...
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/Users/shipilev/Work/shipilev-jdk/src/hotspot/share/runtime/mutexLocker.hpp:237), pid=85876, tid=8451
# assert(mutex != nullptr) failed: null mutex not allowed
#
Stack: [0x000000016f740000,0x000000016f943000], sp=0x000000016f942ba0, free space=2058k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x12393b4] VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long)+0x564 (mutexLocker.hpp:237)
V [libjvm.dylib+0x1239bdc] VMError::report_and_die(Thread*, char const*, int, unsigned long, VMErrorType, char const*, char*)+0x0
V [libjvm.dylib+0x566f50] print_error_for_unit_test(char const*, char const*, char*)+0x0
V [libjvm.dylib+0x10fb084] __cxx_global_var_init.43+0x0
V [libjvm.dylib+0x5998] AbstractInterpreter::print()+0x180
V [libjvm.dylib+0x11522f0] TemplateInterpreter::initialize_code()+0x12c
V [libjvm.dylib+0x86c1ec] interpreter_init_code()+0x10
V [libjvm.dylib+0x83aedc] init_globals2()+0x14
V [libjvm.dylib+0x118f7e0] Threads::create_vm(JavaVMInitArgs*, bool*)+0x2f4
V [libjvm.dylib+0x99e7e0] JNI_CreateJavaVM+0x7c
C [libjli.dylib+0xa344] JavaMain+0x100
C [libjli.dylib+0xd4a0] ThreadJavaMain+0xc
C [libsystem_pthread.dylib+0x6fa8] _pthread_start+0x94
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15043#discussion_r1315168113
More information about the hotspot-dev
mailing list