Java / spring application cannot start on cloudfoundry: outofmemoryerror compresses class space

After deploying the new version of Java / spring boot software to the Swisscom developer cloud running on the cloud foundation, the startup suddenly fails with the following error: outofmemoryerror: compressing the class space Therefore, we decided to deploy a previous version of the software, which was running: the same error occurred We did not switch from Java 7 to Java 8, nor did we change any configuration This leads to a question: is this really an error on our side or on the server side?

Then, we try to set the variable JBP_ CONfig_ OPEN_ JDK_ Set JRE to one of the following lines to increase maxmetaspacesize:

[jre: {version: 1.8.0_+},memory_calculator: {memory_sizes: {Metaspace: 128m}}]
{memory_calculator: {memory_sizes: {Metaspace: 128m}}}
{memory_sizes: {Metaspace: 128m}}

Application always warning, memory_ Invalid value for sizes What is the correct format of this yaml variable?

[ConfigurationUtils] WARN User config value for 'memory_sizes' is not valid,existing property not present

Then, we deleted the Java application and database service on the Swisscom developer console and recreated it It didn't work. The same mistake happened

Finally, do you know why this error suddenly occurred, even if it was a good version running a few minutes ago?

Edit:

This is the list ([database service name] and [application name] are replaced):

---
path: .
instances: 1
buildpack: https://github.com/cloudfoundry/java-buildpack
services:
- [database-service-name]
applications:
- name: [application-name]
  domain: scapp.io
  host: [application-name]
  memory: 1024M
  disk_quota: 1024M
  env:
    SPRING_PROFILES_ACTIVE: stage,cloudfoundry

The Java buildpack version is (according to the log):

2017-03-03 11:47:02 [STG/0] OUT -----> Java Buildpack Version: b08a692 | https://github.com/cloudfoundry/java-buildpack#b08a692

This command appears to have been executed (in the chronicle after the crash):

2017-03-03 11:46:25 [APP/PROC/WEB/0] OUT vcap 8 0 99 10:46 ? 00:01:09 /home/vcap/app/.java-buildpack/open_jdk_jre/bin/java -Djava.io.tmpdir=/home/vcap/tmp -XX:OnOutOfMemoryError=/home/vcap/app/.java-buildpack/open_jdk_jre/bin/killjava.sh -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=68540K -XX:ReservedCodeCacheSize=240M -XX:CompressedClassSpaceSize=8731K -Xmx408104K -Djavax.net.ssl.trustStore=/home/vcap/app/.java-buildpack/container_certificate_trust_store/truststore.jks -Djavax.net.ssl.trustStorePassword=java-buildpack-trust-store-password -cp /home/vcap/app/. org.springframework.boot.loader.WarLauncher

Solution

The OUTOFMEMORY error occurred because the Java buildpack has been changed to use 3.0 of the memory calculator Version X GitHub issue 390 is discussing similar issues caused by this change See this question for more information

Usually, memory calculator v3 X selects the values of various JVM memory settings according to the number of class files in the application, and selects some default values according to the Java version It then sets the maximum heap size to the amount of memory remaining

By setting JBP_ CONfig_ OPEN_ JDK_ JRE is configured with a previous version of the memory calculator However, only in Java_ Set the corresponding JAVA memory settings in opts to configure v3 x. For example, you can set the maximum meta space size to 100 MB, as follows:

cf set-env app-name JAVA_OPTS '-XX:MaxMetaspaceSize=100m'

If you just want a solution, you can use the version of Java buildpack released before the memory calculator changes:

cf push -b https://github.com/cloudfoundry/java-buildpack.git\#v3.14 ...
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>