Extracted from JDK-8361462:
The original semaphore related crash was:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S577077/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/1725c443-f2fc-4cb3-8d36-4912f92abfb1/runs/bf13cee2-c1c1-49dc-af9a-95488455fd59/workspace/open/src/hotspot/os/bsd/semaphore_bsd.cpp:65), pid=69909, tid=58739
# assert(ret == 0) failed: Failed to wait on semaphore
--------------- T H R E A D ---------------
Current thread (0x0000000298d41a10): JavaThread "Thread-7972" daemon [_thread_in_vm, id=58739, stack(0x000000028ab04000,0x000000028ad07000) (2060K)]
Stack: [0x000000028ab04000,0x000000028ad07000], sp=0x000000028ad05c30, free space=2055k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x12125c8] VMError::report(outputStream*, bool)+0x1b00 (semaphore_bsd.cpp:65)
V [libjvm.dylib+0x1215e68] VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void const*, void const*, char const*, int, unsigned long)+0x55c
V [libjvm.dylib+0x5a8448] print_error_for_unit_test(char const*, char const*, char*)+0x0
V [libjvm.dylib+0xfd8330] OSXSemaphore::trywait()+0x0
V [libjvm.dylib+0x98cd00] JfrThreadGroup::thread_group_id_internal(JfrThreadGroupsHelper&)+0x30
V [libjvm.dylib+0x98cc10] JfrThreadGroup::thread_group_id(JavaThread const*, Thread*)+0xe8
The JFR code has been reorganized somewhat since the initial report but it still contains three statically allocated Semaphores:
./share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp: static Semaphore _mutex_semaphore;
./share/jfr/recorder/checkpoint/types/jfrThreadGroupManager.cpp: static Semaphore _mutex_semaphore;
./share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp: static Semaphore _mutex_semaphore;
These Semaphores need to be examined to see if they can be used after the static destructor has executed, during VM termination. The Semaphore is unsafe if it can be accessed by a `NonJavaThread`, or by a `JavaThread` in a safepoint-safe state.
The original semaphore related crash was:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S577077/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/1725c443-f2fc-4cb3-8d36-4912f92abfb1/runs/bf13cee2-c1c1-49dc-af9a-95488455fd59/workspace/open/src/hotspot/os/bsd/semaphore_bsd.cpp:65), pid=69909, tid=58739
# assert(ret == 0) failed: Failed to wait on semaphore
--------------- T H R E A D ---------------
Current thread (0x0000000298d41a10): JavaThread "Thread-7972" daemon [_thread_in_vm, id=58739, stack(0x000000028ab04000,0x000000028ad07000) (2060K)]
Stack: [0x000000028ab04000,0x000000028ad07000], sp=0x000000028ad05c30, free space=2055k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.dylib+0x12125c8] VMError::report(outputStream*, bool)+0x1b00 (semaphore_bsd.cpp:65)
V [libjvm.dylib+0x1215e68] VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void const*, void const*, char const*, int, unsigned long)+0x55c
V [libjvm.dylib+0x5a8448] print_error_for_unit_test(char const*, char const*, char*)+0x0
V [libjvm.dylib+0xfd8330] OSXSemaphore::trywait()+0x0
V [libjvm.dylib+0x98cd00] JfrThreadGroup::thread_group_id_internal(JfrThreadGroupsHelper&)+0x30
V [libjvm.dylib+0x98cc10] JfrThreadGroup::thread_group_id(JavaThread const*, Thread*)+0xe8
The JFR code has been reorganized somewhat since the initial report but it still contains three statically allocated Semaphores:
./share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp: static Semaphore _mutex_semaphore;
./share/jfr/recorder/checkpoint/types/jfrThreadGroupManager.cpp: static Semaphore _mutex_semaphore;
./share/jfr/recorder/checkpoint/types/jfrTypeManager.cpp: static Semaphore _mutex_semaphore;
These Semaphores need to be examined to see if they can be used after the static destructor has executed, during VM termination. The Semaphore is unsafe if it can be accessed by a `NonJavaThread`, or by a `JavaThread` in a safepoint-safe state.
- relates to
-
JDK-8361462 JVM crashed with assert(ret == 0) failed: Failed to wait on semaphore
-
- In Progress
-
- links to
-
Review(master) openjdk/jdk/27722