Metaspace out of memory even 20-30% or more space free

1k views Asked by At

A Keycloak/JBoss server running using Java 8 was switched to G1GC and a -XX:MaxMetaspaceSize was set to 256MB. It soon stopped responding with logs filling up with OutOfMemory: Metaspace errors. GC logs were not enabled. Server was hooked with Dynatrace monitoring service which showed plenty of metapsace available.

191MB used out of 256MB allocated on one occasion. 165MB used out of 256MB allocated on a second occurrence.

I understand that to free metaspace, GC was invoked and being unable to free enough space it was running GC after GC so it makes sense why the process was stuck. However, what I am unable to understand is why process was running out of metaspace even when plenty was free. No other JVM parameter was provided (except XMS/XMX). All heap memory sections had plenty of free space. Was something trying to allocate 60MB+ space in metaspace? Is this the only possible reason?

0

There are 0 answers