Working with CF2016 I have been seeing this error in a developer environment and also in production enviroments but less frecuently.
Metaspace null. The error ocurred on line -1.
Reading some forums get the idea of the garbage collector and managed to implement this code to force the collector:
<cfset runtime = CreateObject("java","java.lang.Runtime").getRuntime()>
<cfset freeMemory = runtime.freeMemory() / 1024 / 1024>
<cfset totalMemory = runtime.totalMemory() / 1024 / 1024>
<cfset maxMemory = runtime.maxMemory() / 1024 / 1024>
<cfset usedMemory = (runtime.totalMemory() - runtime.freeMemory()) / 1024 / 1024>
<cfoutput>
Used Memory: #Round(usedMemory)#mb<br>
Free Allocated Memory: #Round(freeMemory)#mb<br>
Total Memory Allocated: #Round(totalMemory)#mb<br>
Max Memory Available to JVM: #Round(maxMemory)#mb<br>
</cfoutput>
<cfset clear = runtime.gc()>
Curiously, the runtime memory has a lot of space (normaly half of space is free) But Metaspace Null
still appearing.
Another aproache could be the loaded classes, maybe they are not being destroyed automatically. But I can't find a way to see the loaded ones.
So far the "solution" is to restart the server so I can operate normally. I was able to reduce the frecuency of the error increasing the Maximum JVM Heap Size to 1024MB but still ocurring
And the stacktrace... well is hard to get to the line -1 in a ghost file! xD
Java Version: 1.8.0_112
Garbage Collector: -XX:+UseParallelGC (default)
Arguments to VM (line jumps for easy reading)
java.args=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006 -server
-Xms256m
-Xmx1024m
-XX:MaxMetaspaceSize=192m
-XX:+UseParallelGC
-Xbatch
-Dcoldfusion.home={application.home}
-Djava.awt.headless=true
-Duser.language=en
-Dcoldfusion.rootDir={application.home}
-Djava.security.policy={application.home}/lib/coldfusion.policy
-Djava.security.auth.policy={application.home}/lib/neo_jaas.policy
-Dcoldfusion.classPath={application.home}/lib/updates,{application.home}/lib,{application.home}/lib/axis2,{application.home}/gateway/lib/,{application.home}/wwwroot/WEB-INF/cfform/jars,{application.home}/wwwroot/WEB-INF/flex/jars,{application.home}/lib/oosdk/lib,{application.home}/lib/oosdk/classes
-Dcoldfusion.libPath={application.home}/lib
-Dorg.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER=true
-Dcoldfusion.jsafe.defaultalgo=FIPS186Random
-Dorg.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.JavaUtilLog
-Djava.util.logging.config.file={application.home}/lib/logging.properties