RFR: 8366865: G1: Allocation GC Pauses Triggered after JVM has started shutdown

Ivan Walulya iwalulya at openjdk.org
Wed Sep 10 13:59:58 UTC 2025


On Wed, 10 Sep 2025 13:51:50 GMT, Albert Mingkun Yang <ayang 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
>
> src/hotspot/share/gc/shared/gcVMOperations.cpp line 115:
> 
>> 113: 
>> 114:   // Check invocations
>> 115:   if (skip_operation() || Universe::heap()->is_shutting_down()) {
> 
> Can the new condition be inlined inside `skip_operation()`?

In the first iteration I had it inlined, but then decided to make it more explicit. I can change it back if you prefer

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

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


More information about the hotspot-gc-dev mailing list