MaxMetaspaceSize and CompressedClassSpaceSize

Yasumasa Suenaga yasuenag at gmail.com
Thu Jun 11 10:52:46 UTC 2015


Hi all,

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

This java process is enabled CompressedClassSpace (as default).
Metaspace size in GC log seems to be contained it (1GB).

I checked arguments.cpp and metaspace.cpp, CompressedClassSpaceSize
does not seem to be checked consistent with MaxMetaspaceSize.

Does JVM have to check CompressedClassSpaceSize and InitialBootClassLoaderMetaspaceSize
which are consistent with MaxMetaspaceSize?

I think we can fix as below:
------------
diff -r 85e2c3553384 src/share/vm/runtime/arguments.cpp
--- a/src/share/vm/runtime/arguments.cpp        Wed Jun 03 08:49:34 2015 +0900
+++ b/src/share/vm/runtime/arguments.cpp        Thu Jun 11 19:50:11 2015 +0900
@@ -2333,6 +2333,15 @@
   status = status && verify_interval(CompressedClassSpaceSize, 1*M, 3*G,
                                       "CompressedClassSpaceSize");

+  if (UseCompressedClassPointers) {
+    status = status &&
+         ((CompressedClassSpaceSize + InitialBootClassLoaderMetaspaceSize)
+                                                           <= MaxMetaspaceSize);
+  } else {
+    status = status &&
+                (InitialBootClassLoaderMetaspaceSize <= MaxMetaspaceSize);
+  }
+
   status = status && verify_interval(MarkStackSizeMax,
                                   1, (max_jint - 1), "MarkStackSizeMax");
   status = status && verify_interval(NUMAChunkResizeWeight, 0, 100, "NUMAChunkResizeWeight");
------------


If it is accepted as a bug, I will file it to JBS and upload webrev.


Thanks,

Yasumasa




More information about the hotspot-gc-dev mailing list