Failure scenarios

Per Liden per.liden at oracle.com
Wed Apr 10 15:38:16 UTC 2019


Hi,

On 04/10/2019 04:43 PM, Simone Bordet wrote:
> Hi,
> 
> I would like to ask a few questions about how ZGC handles failure scenarios.
> 
> If there is an allocation failure, but the GC is currently running, my
> understanding is that the allocating thread will pause until the GC
> can make space for the request allocation.
> AFAIK, this is called "Allocation Stall" and it's reported by ZGC logging.
> Is my understanding correct?

That's correct. And note that space can become available before the GC 
cycle has completed. For example, during relocation set selection, 
ZPages that have zero live objects are immediately free up. And during 
relocation, as ZPages are emptied they are immediately made available 
for new allocations.

> 
> Also AFAIK there is no fall back to Full GCs. Is this correct?

Correct. Since ZGC is compacting (as opposed to copying) there's no need 
for any fall back. Put another way, if the normal GC cycle failed to 
free up memory, then any fallback "full GC" will also fail.

> 
> If ZGC cannot free space, there is no retry and no more stalling of
> the allocating thread, but just a OOME. Is that right?

That's right. A stalled Java thread will give up and throw OOME if one 
complete GC cycle has passed and there's still no memory available. So, 
if a thread stalls when a GC cycle is in progress then it will not throw 
OOME until another cycle has been completed.

cheers,
Per

> 
> Thanks!
> 


More information about the zgc-dev mailing list