RFR: 8366865: Allocation GC Pauses Triggered after JVM has started shutdown [v7]
Ivan Walulya
iwalulya at openjdk.org
Thu Sep 18 13:31:43 UTC 2025
On Tue, 16 Sep 2025 14:44:20 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:
>> I had put `log_cpu_time` right before calling `stop()`. The `stop()` is the method that terminates GC threads, so no synchronization should be needed if I'm not mistaken.
>>
>> Please correct me if you think I got it wrong here.
>>
>> Nevertheless, any user of `gc_threads_do` might still iterate over terminated GC workers thread. Could we consider adding a check or assert in that method?
>
> We can have GCs between `log_cpu_time` and `stop()`. This reduces chances of that happening if we have `log_cpu_time` under same lock as setting `_is_shutting_down`.
>
>> Nevertheless, any user of gc_threads_do might still iterate over terminated GC workers thread. Could we consider adding a check or assert in that method?
>
> Yes, we can have the assert in `gc_threads_do`, I thought this was going to be done as a follow up.
I moved `_is_shutting_down` to `Universe`, which allowed me to restore this `log_cpu_time`. I also added the assert before reading `os::thread_cpu_time`
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27190#discussion_r2359318824
More information about the hotspot-dev
mailing list