RFR: 8367902: Allocation after Universe::before_exit() in the VM shutdown sequence

Leonid Mesnik lmesnik at openjdk.org
Tue Nov 11 18:33:04 UTC 2025


On Tue, 11 Nov 2025 10:03:23 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Please review following fix that move GC shutdown start after VM Death and agent's unloading.
>> 
>> The `Universe::before_exit();` switch GC to fail any new GC allocation. So any allocation in vm death is failing.
>> 
>> The test is a little bit complicated because jtreg uses wrapper even to execute othrevm tests and also results might be confusing if test is failing after main() method is completed. So the better is to run new process for vm death event handling.
>
>> move GC shutdown start after VM Death and agent's unloading
> 
> Is there a reason why `Universe::before_exit()` is moved down, instead of moving jvmti related calls (before `Universe::before_exit()`)?
> 
> (The current patch would leave GC running while calling `MemMapPrinter::print_all_mappings(tty);` -- GC can potentially alter mappings.)

@albertnetymk, @stefank 

> > move GC shutdown start after VM Death and agent's unloading
> 
> Is there a reason why `Universe::before_exit()` is moved down, instead of moving jvmti related calls (before `Universe::before_exit()`)?

I updated to move jvmti code. Seems that following opertaions
  WatcherThread::stop();
  NativeHeapTrimmer::cleanup(); 
might be done before sending jvmti vm_death.

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

PR Comment: https://git.openjdk.org/jdk/pull/28227#issuecomment-3518247296


More information about the hotspot-gc-dev mailing list