RFR: 8366865: Allocation GC Pauses Triggered after JVM has started shutdown [v8]
Albert Mingkun Yang
ayang at openjdk.org
Fri Sep 19 10:05:30 UTC 2025
On Fri, 19 Sep 2025 05:17:23 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 incrementally with one additional commit since the last revision:
>
> remove assert
src/hotspot/share/gc/shared/collectedHeap.cpp line 626:
> 624: // triggers a GC.
> 625: MonitorLocker ml(VMExit_lock);
> 626: ml.wait(2 * MILLIUNITS);
I think one can use `ThreadBlockInVM` + sleep to achieve the blocking-current-thread purpose. Then, there is no need for a new lock, as there is no critical-region anyway.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27190#discussion_r2362381514
More information about the hotspot-dev
mailing list