JDK-8366328 : G1: Crash on reading os::thread_cpu_time
  • Type: Bug
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: 26
  • Priority: P2
  • Status: Open
  • Resolution: Unresolved
  • OS: linux_alpine,aix
  • Submitted: 2025-08-28
  • Updated: 2025-09-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 26
26Unresolved
Related Reports
Causes :  
Relates :  
Relates :  
Description
[~mbaesken]  We see now observe asserts on AIX, triggered by runtime/Shutdown/ShutdownTest.java :
#
# Internal Error (/priv/jenkins/client-home/workspace/openjdk-jdk-aix_ppc64-dbg/jdk/src/hotspot/os/aix/os_aix.cpp:2393), pid=18416088, tid=2057
# assert(n >= 0) failed: negative CPU time
#

Stack: [0x0000000114230000,0x000000011444c888], sp=0x000000011444b040, free space=2156k
No context given, using current context.
Native frame:
iar: 0x090000000c16ef8c libjvm.so::AixNativeCallstack::print_callstack_for_context(outputStream*, ucontext_t const*, bool, char*, unsigned long)+0x4ec (C++ uses_alloca saves_cr saves_lr stores_bc gpr_saved:18 fixedparms:5 parmsonstk:1)
lr: 0x000000011444a270 (unknown module)::(unknown function)+?
sp: 0x0000000114449fe0 (base - 0x28A8)
rtoc: 0x08001000a045e2f8
|---stackaddr----| |----lrsave------|: <function name>
0x000000011444a3d0 - 0x090000000c16ea24 libjvm.so::os::Aix::platform_print_native_stack(outputStream*, void const*, char*, int, unsigned char*&)+0x24 (C++ uses_alloca saves_lr stores_bc gpr_saved:1 fixedparms:5 parmsonstk:1)
0x000000011444a450 - 0x090000000c16e8d8 libjvm.so::NativeStackPrinter::print_stack(outputStream*, char*, int, unsigned char*&, bool, int)+0x58 (C++ fp_present uses_alloca saves_cr saves_lr stores_bc gpr_saved:6 fixedparms:7 parmsonstk:1)
0x000000011444a560 - 0x090000000c900a58 libjvm.so::VMError::report(outputStream*, bool)+0x23b8 (C++ fp_present uses_alloca saves_cr saves_lr stores_bc gpr_saved:18 fixedparms:2 parmsonstk:1)
0x000000011444b050 - 0x090000000bedc030 libjvm.so::VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void const*, void const*, char const*, int, unsigned long)+0x870 (C++ uses_alloca saves_lr stores_bc gpr_saved:18 fixedparms:8 parmsonstk:1)
0x000000011444b230 - 0x090000000bedb4e0 libjvm.so::report_vm_error(char const*, int, char const*, char const*, ...)+0xa0 (C++ uses_alloca saves_lr stores_bc gpr_saved:5 fixedparms:4 parmsonstk:1)
0x000000011444b2f0 - 0x090000000befbae8 libjvm.so::os::thread_cpu_time(Thread*)+0x68 (C++ uses_alloca saves_lr stores_bc gpr_saved:1 fixedparms:1 parmsonstk:1)
0x000000011444b370 - 0x090000000c13a1e4 libjvm.so::CPUTimeThreadClosure::do_thread(Thread*)+0x24 (C++ uses_alloca saves_lr stores_bc gpr_saved:2 fixedparms:2 parmsonstk:1)
0x000000011444b3f0 - 0x090000000c693878 libjvm.so::G1CollectedHeap::gc_threads_do(ThreadClosure*) const+0x58 (C++ uses_alloca saves_lr stores_bc gpr_saved:3 fixedparms:2 parmsonstk:1)
0x000000011444b480 - 0x090000000c13a15c libjvm.so::CPUTimeUsage::GC::gc_threads()+0x5c (C++ uses_alloca saves_lr stores_bc gpr_saved:1 parmsonstk:1)
0x000000011444b510 - 0x090000000c3b11f8 libjvm.so::G1Analytics::gc_cpu_time_ms() const+0x18 (C++ fp_present uses_alloca saves_lr stores_bc gpr_saved:1 fixedparms:1 parmsonstk:1)
0x000000011444b590 - 0x090000000c3b0efc libjvm.so::G1Policy::record_young_collection_start()+0x5c (C++ fp_present uses_alloca saves_lr stores_bc fpr_saved:1 gpr_saved:6 fixedparms:1 parmsonstk:1)
0x000000011444b650 - 0x090000000c3a3168 libjvm.so::G1YoungCollector::collect()+0x268 (C++ fp_present uses_alloca saves_lr stores_bc gpr_saved:10 fixedparms:1 parmsonstk:1)
0x000000011444bb50 - 0x090000000c39d1f4 libjvm.so::G1CollectedHeap::do_collection_pause_at_safepoint_helper(unsigned long)+0xf4 (C++ uses_alloca saves_lr stores_bc gpr_saved:7 fixedparms:2 parmsonstk:1)
0x000000011444bcf0 - 0x090000000c39d010 libjvm.so::G1CollectedHeap::do_collection_pause_at_safepoint(unsigned long)+0xb0 (C++ uses_alloca saves_lr stores_bc gpr_saved:3 fixedparms:2 parmsonstk:1)
0x000000011444bd80 - 0x090000000c604544 libjvm.so::VM_G1CollectForAllocation::doit()+0xa4 (C++ uses_alloca saves_lr stores_bc gpr_saved:5 fixedparms:1 parmsonstk:1)
0x000000011444be20 - 0x090000000bfdfdc0 libjvm.so::VM_Operation::evaluate()+0x160 (C++ uses_alloca saves_lr stores_bc gpr_saved:6 fixedparms:1 parmsonstk:1)
0x000000011444bfb0 - 0x090000000bfdf784 libjvm.so::VMThread::evaluate_operation(VM_Operation*)+0x184 (C++ fp_present uses_alloca saves_cr saves_lr stores_bc gpr_saved:11 fixedparms:2 parmsonstk:1)
0x000000011444c130 - 0x090000000bfdf08c libjvm.so::VMThread::inner_execute(VM_Operation*)+0x42c (C++ uses_alloca saves_cr saves_lr stores_bc gpr_saved:11 fixedparms:2 parmsonstk:1)
0x000000011444c4e0 - 0x090000000d1d4818 libjvm.so::VMThread::loop()+0xd8 (C++ uses_alloca saves_lr stores_bc gpr_saved:5 fixedparms:1 parmsonstk:1)
0x000000011444c580 - 0x090000000d1d44c8 libjvm.so::VMThread::run()+0x108 (C++ uses_alloca saves_lr stores_bc gpr_saved:5 fixedparms:1 parmsonstk:1)
0x000000011444c650 - 0x090000000bfc7148 libjvm.so::Thread::call_run()+0x128 (C++ uses_alloca saves_lr stores_bc gpr_saved:3 fixedparms:1 parmsonstk:1)
0x000000011444c6e0 - 0x090000000bfc640c libjvm.so::thread_native_entry(Thread*)+0x20c (C++ uses_alloca saves_lr stores_bc gpr_saved:8 fixedparms:1 parmsonstk:1)
0x000000011444c7a0 - 0x090000000056204c libpthreads.a::_pthread_body+0xec (C saves_lr stores_bc gpr_saved:1 fixedparms:1 )
0x000000011444c820 - 0x0000000000000000 
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/27087 Date: 2025-09-04 07:48:11 +0000
04-09-2025

Hi [~iwalulya] do you plan to create a PR for this, with an added check for dead threads? [~tschatzl] do we have already similar checks in the codebase ?
04-09-2025

compiler/whitebox/AllocationCodeBlobTest.java fails sometimes too because of this issue : # Internal Error (/priv/jenkins/client-home/workspace/openjdk-jdk-linux_alpine_x86_64-dbg/jdk/src/hotspot/os/linux/os_linux.cpp:4203), pid=26376, tid=26394 # assert(status == 0) failed: clock_gettime error: Invalid argument
01-09-2025

> Then the code getting cpu usage tries to do that on already dead threads, which is forbidden Maybe an assert checking for dead threads "at the right place" would help to check and 'see' this better?
29-08-2025

we suspect that these gc pauses occur during shutdown between stopping the gc threads and executing the final "exit" VM operation. Then the code getting cpu usage tries to do that on already dead threads, which is forbidden - at least the assert on AIX strongly suggests that the OS call returns an error.
29-08-2025

Those jtreg tests compiler/startup/StartupOutput.java compiler/vectorization/TestVectorsNotSavedAtSafepoint.java runtime/Shutdown/ShutdownTest.java generate quite a lot of asserts (or on Linux Alpine crashes) as given in the Description , but it is triggered also sometimes by other tests.
29-08-2025

I added hserr files from AIX and Linux Alpine (the Linux Alpine crash is a little different).
28-08-2025