SUMMARY: We have established that during VM termination when `exit()` has been invoked, we can still execute code that tries to use Semaphore's for which the static destructor has already been executed, resulting in the observed assertion failures. Separate issues are created for the numerous (directly or indirectly) statically defined Semaphore instances, so that their safe usage can be evaluated and corrected if needed. The Semaphore is unsafe if it can be accessed by a `NonJavaThread`, or by a `JavaThread` in a safepoint-safe state.
---
For random generator using seed: 5323127887678115242
To re-run test with same seed value please add "-Djdk.test.lib.random.seed=5323127887678115242" to command line.
Stress process main method is started.
[234.178s][error][jvmti] Posting Resource Exhausted event: Java heap space
[310.199s][error][jvmti] Posting Resource Exhausted event: Requested array size exceeds VM limit
[572.061s][error][jvmti] Posting Resource Exhausted event: Requested array size exceeds VM limit
Fatal error in jvmti native agent: (ForceEarlyReturnVoid) unexpected error: (113). GetErrorName finished with error (0).
#
# 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
#
# JRE version: Java(TM) SE Runtime Environment (26.0+6) (fastdebug build 26-ea+6-492)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-ea+6-492, mixed mode, tiered, compressed oops, compressed class ptrs, serial gc, bsd-aarch64)
# Core dump will be written. Default location: core.69909
#
[thread 66547 also had an error]
# JFR recording file will be written. Location: /System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/hs_err_pid69909.jfr
#
Unsupported internal testing APIs have been used.
Interestingly the hs_err file is truncated:
#
# 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
#
# JRE version: Java(TM) SE Runtime Environment (26.0+6) (fastdebug build 26-ea+6-492)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-ea+6-492, mixed mode, tiered, compressed oops, compressed class ptrs, serial gc, bsd-aarch64)
# Core dump will be written. Default location: core.69909
#
# JFR recording file will be written. Location: /System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/hs_err_pid69909.jfr
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
--------------- S U M M A R Y ------------
Command Line: -Xbootclasspath/a:/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/wb.jar -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:MaxRAMPercentage=6.25 -Dtest.boot.jdk=/System/Volumes/Data/mesos/work_dir/jib-master/install/jdk/24/36/bundles/macos-aarch64/jdk-24_macos-aarch64_bin.tar.gz/jdk-24.jdk/Contents/Home -Djava.io.tmpdir=/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/tmp -XX:+UseSerialGC -XX:MaxRAMPercentage=50 -Djava.net.preferIPv6Addresses=false -XX:+DisplayVMOutputToStderr -Xlog:gc*,gc+heap=debug:gc.log:uptime,timemillis,level,tags -XX:+DisableExplicitGC -XX:+StartAttachListener -XX:CompileCommand=memlimit,*.*,0 -Xlog:monitorinflation=info:file=../monitorinflation.log::filesize=500m -Djava.io.tmpdir=/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/java.io.tmpdir -Duser.home=/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/user.home -agentpath:/System/Volumes/Data/mesos/work_dir/jib-master/install/jdk-26+6-492/macosx-aarch64-debug.test/hotspot/jtreg/native/libJvmtiStressModule.dylib -Xverify:all -javaagent:redefineagent.jar -XX:NativeMemoryTracking=detail -Djdk.test.lib.random.seed=5323127887678115242 applications.kitchensink.process.stress.Main /System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/kitchensink.final.properties
Host: "Mac14,3" arm64, 8 cores, 16G, Darwin 22.3.0, macOS 13.2.1 (22D68)
Time: Sun Jul 6 01:11:19 2025 GMT elapsed time: 924.390394 seconds (0d 0h 15m 24s)
--------------- 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
V [libjvm.dylib+0x99ef70]
---
For random generator using seed: 5323127887678115242
To re-run test with same seed value please add "-Djdk.test.lib.random.seed=5323127887678115242" to command line.
Stress process main method is started.
[234.178s][error][jvmti] Posting Resource Exhausted event: Java heap space
[310.199s][error][jvmti] Posting Resource Exhausted event: Requested array size exceeds VM limit
[572.061s][error][jvmti] Posting Resource Exhausted event: Requested array size exceeds VM limit
Fatal error in jvmti native agent: (ForceEarlyReturnVoid) unexpected error: (113). GetErrorName finished with error (0).
#
# 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
#
# JRE version: Java(TM) SE Runtime Environment (26.0+6) (fastdebug build 26-ea+6-492)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-ea+6-492, mixed mode, tiered, compressed oops, compressed class ptrs, serial gc, bsd-aarch64)
# Core dump will be written. Default location: core.69909
#
[thread 66547 also had an error]
# JFR recording file will be written. Location: /System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/hs_err_pid69909.jfr
#
Unsupported internal testing APIs have been used.
Interestingly the hs_err file is truncated:
#
# 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
#
# JRE version: Java(TM) SE Runtime Environment (26.0+6) (fastdebug build 26-ea+6-492)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 26-ea+6-492, mixed mode, tiered, compressed oops, compressed class ptrs, serial gc, bsd-aarch64)
# Core dump will be written. Default location: core.69909
#
# JFR recording file will be written. Location: /System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/hs_err_pid69909.jfr
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
#
--------------- S U M M A R Y ------------
Command Line: -Xbootclasspath/a:/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/wb.jar -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:MaxRAMPercentage=6.25 -Dtest.boot.jdk=/System/Volumes/Data/mesos/work_dir/jib-master/install/jdk/24/36/bundles/macos-aarch64/jdk-24_macos-aarch64_bin.tar.gz/jdk-24.jdk/Contents/Home -Djava.io.tmpdir=/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/tmp -XX:+UseSerialGC -XX:MaxRAMPercentage=50 -Djava.net.preferIPv6Addresses=false -XX:+DisplayVMOutputToStderr -Xlog:gc*,gc+heap=debug:gc.log:uptime,timemillis,level,tags -XX:+DisableExplicitGC -XX:+StartAttachListener -XX:CompileCommand=memlimit,*.*,0 -Xlog:monitorinflation=info:file=../monitorinflation.log::filesize=500m -Djava.io.tmpdir=/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/java.io.tmpdir -Duser.home=/System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/user.home -agentpath:/System/Volumes/Data/mesos/work_dir/jib-master/install/jdk-26+6-492/macosx-aarch64-debug.test/hotspot/jtreg/native/libJvmtiStressModule.dylib -Xverify:all -javaagent:redefineagent.jar -XX:NativeMemoryTracking=detail -Djdk.test.lib.random.seed=5323127887678115242 applications.kitchensink.process.stress.Main /System/Volumes/Data/mesos/work_dir/slaves/d2398cde-9325-49c3-b030-8961a4f0a253-S576526/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/881efc11-8a0a-4b23-ab2a-a751f36d48e2/runs/d04547ca-129a-4075-a52d-b1f851337dcc/testoutput/test-support/jtreg_closed_test_hotspot_jtreg_applications_runthese_RunThese30M_java/scratch/0/kitchensink.final.properties
Host: "Mac14,3" arm64, 8 cores, 16G, Darwin 22.3.0, macOS 13.2.1 (22D68)
Time: Sun Jul 6 01:11:19 2025 GMT elapsed time: 924.390394 seconds (0d 0h 15m 24s)
--------------- 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
V [libjvm.dylib+0x99ef70]
- relates to
-
JDK-8369255 Assess and remedy any unsafe usage of the Semaphores used by JFR
-
- In Progress
-
-
JDK-8369336 Assess and remedy any unsafe usage of the Semaphore used by Unified Logging
-
- New
-
-
JDK-8369337 Assess and remedy any unsafe usage of the Semaphore used by Compiler events
-
- New
-
-
JDK-8369338 Assess and remedy any unsafe usage of the Semaphore used by the Perf code on Windows
-
- New
-
-
JDK-8369250 Assess and remedy any unsafe usage of the Semaphore used by NonJavaThread::List
-
- Resolved
-