RFR: 8366328: G1: Crash on reading os::thread_cpu_time

Albert Mingkun Yang ayang at openjdk.org
Thu Sep 4 10:12:41 UTC 2025


On Thu, 4 Sep 2025 07:48:11 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

> Hi,
> 
> Please review this patch to ensure that we do not attempt to read CPU time for GC threads that have already been terminated.
> 
> Testing: Tier 1-3.

src/hotspot/share/gc/g1/g1Policy.cpp line 672:

> 670:   // Only compute concurrent GC CPU time if the VM is not in the process of shutting down.
> 671:   double concurrent_gc_cpu_time_ms = 0.0;
> 672:   if (!_g1h->is_shutting_down()) {

Why is `is_shutting_down` checked here? Can its caller ensure we are not in shutdown, e.g. `G1CollectedHeap::do_collection_pause_at_safepoint`?

The current method name kind of suggests that we are in normal gc-pause, not shutdown process, IMO.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27087#discussion_r2321523520


More information about the hotspot-gc-dev mailing list