JDK-8087291 : InitialBootClassLoaderMetaspaceSize and CompressedClassSpaceSize should be checked consistent from MaxMetaspaceSize
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-06-12
  • Updated: 2019-05-22
  • Resolved: 2017-10-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 8
10 b31Fixed 8u162Fixed
Description
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-1.8.0.45-39.b14.fc22.x86_64
      - 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.


[1] http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2015-June/013817.html
Comments
I'm moving this bug over the the Runtime component.
14-09-2017

Yasumasa has posted a webrev on hotspot-gc-dev: http://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2015-June/013899.html
19-04-2016

Latest webrev is here: http://cr.openjdk.java.net/~ysuenaga/JDK-8087291/webrev.02/
23-02-2016

ILW = Low (info/warning needed at startup), Low (special cases), Low (use different settings) = P5
12-06-2015