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

Jonas Norlinder duke at openjdk.org
Tue Sep 16 14:06:44 UTC 2025


On Tue, 16 Sep 2025 12:14:28 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> src/hotspot/share/memory/universe.cpp line 1347:
>> 
>>> 1345: 
>>> 1346: void Universe::before_exit() {
>>> 1347:   log_cpu_time();
>> 
>> Why did you move `log_cpu_time()`? During the review of CPUTimeUsage refactor (https://github.com/openjdk/jdk/pull/26621) we discussed this choice. Given that it still includes more than just GC I think it should stay in `Universe`. Also the PR title does not reflect that it would include a refactor of CPUTimeUsage.
>
> 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?

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

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


More information about the hotspot-dev mailing list