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

Albert Mingkun Yang ayang at openjdk.org
Mon Sep 22 10:46:56 UTC 2025


On Mon, 22 Sep 2025 05:56:58 GMT, Ivan Walulya <iwalulya at openjdk.org> wrote:

>> Please review this patch to skip VM_GC_Collect_Operations  if initiated after the VM shutdown process has begun. We add a _is_shutting_down flag to CollectedHeap, which is set while holding the Heap_lock. This ensures mutual exclusion with VM_GC_Collect_Operations, which also require the Heap_lock.
>> 
>> Skipping VM_GC_Collect_Operation would otherwise cause allocation requests to fail (resulting in OutOfMemoryError) if requesting daemon threads were allowed to continue, we instead block these threads on a monitor. They remain stalled until they are terminated as part of the VM shutdown sequence.
>> 
>> Testing: Tier 1-7
>
> Ivan Walulya has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 18 commits:
> 
>  - Merge remote-tracking branch 'upstream/master' into shutting_down_gcs
>  - Remove lock
>  - remove assert
>  - make universal
>  - Merge remote-tracking branch 'upstream/master' into shutting_down_gcs
>  - Merge remote-tracking branch 'upstream/master' into shutting_down_gcs
>  - Merge remote-tracking branch 'upstream/master' into shutting_down_gcs
>  - Revert
>  - Thomas Review
>  - return on timeout
>  - ... and 8 more: https://git.openjdk.org/jdk/compare/cc65836d...87c80194

src/hotspot/share/memory/universe.cpp line 1349:

> 1347: void Universe::before_exit() {
> 1348:   {
> 1349:     MutexLocker hl(Heap_lock);

Could you add some comment for why locking is needed here? Better reference the read of `_is_shutting_down` in `VM_GC_Operation::doit_prologue`.

Good otherwise.

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

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


More information about the hotspot-dev mailing list