RFR: 8366865: Allocation GC Pauses Triggered after JVM has started shutdown [v5]

Ivan Walulya iwalulya at openjdk.org
Tue Sep 16 14:46:43 UTC 2025


On Tue, 16 Sep 2025 14:03:28 GMT, Jonas Norlinder <duke at openjdk.org> wrote:

>> Main reason was to have the `log_cpu_time` and `AtomicAccess::release_store(&_is_shutting_down, true)` under same critical section. Otherwise, we have no guarantee that we don't continue GCs after `log_cpu_time`.
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27190#discussion_r2352757631


More information about the hotspot-dev mailing list