RFR: JDK-8087291: InitialBootClassLoaderMetaspaceSize and CompressedClassSpaceSize should be checked consistent from MaxMetaspaceSize

Yasumasa Suenaga yasuenag at gmail.com
Fri Jun 12 03:25:44 UTC 2015

Hi all,

This issue is related to [1].

I booted Tomcat 8 with "-XX:MaxMetaspaceSize=5m -XX:+PrintGCDetails", but it failed. 
I checked GC log, Java heap and Metaspace was NOT exhausted. 

[Full GC (Last ditch collection) [Tenured: 1049K->1049K(10944K), 0.0050992 secs] 1049K->1049K(15936K), [Metaspace: 4871K->4871K(1056768K)], 0.0051411 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 
[Full GC (Metadata GC Threshold) [Tenured: 1049K->1049K(10944K), 0.0050587 secs] 1049K->1049K(15936K), [Metaspace: 4871K->4871K(1056768K)], 0.0051023 secs] [Times: user=0.00 sys=0.00, real=0.01 secs]
[Full GC (Last ditch collection) [Tenured: 1049K->1049K(10944K), 0.0050200 secs] 1049K->1049K(15936K), [Metaspace: 4871K->4871K(1056768K)], 0.0050613 secs] [Times: user=0.01 sys=0.00, real=0.00 secs] 

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main" 

My environment: 
     Fedora22 x86_64 
      - kernel-4.0.4-303.fc22.x86_64 
      - glibc-2.21-5.fc22.x86_64 
      - java-1.8.0-openjdk- 
      - apache-tomcat-8.0.23 

The Compressed ClassSpace is a part of Metaspace. 
The size of the Compressed ClassSpace is included in the comparison with MaxMetaspaceSize only 
when the space is committed [1]. 
However, users cannot know their incorrect parameter(s) until memory space will be committed. 

Compressed ClassSpace is continuous memory space, and its default value is 1GB. 
In case of Linux, it affects overcommit memory. It will be cause of OOM-killer at the worst case. 

So I want to alert inconsistency metaspace setting at early as possible. 

I'm jdk9 committer, but I'm not employee at Oracle.
So I need a Sponsor.



 [1] http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2015-June/013817.html 

More information about the hotspot-gc-dev mailing list