Coldfusion Metaspace issue

From time to time we are facing the metaspace issue on various ColdFusion servers. The websites are frozen and in the error log you can find something like this:

“Error”,”http-nio-8500-exec-7″,”06/04/20″,”12:09:39″,”cfadmin”,”Metaspace The specific sequence of files included or processed is: C:\ColdFusion2016\cfusion\wwwroot\CFIDE\administrator\topnav.cfm” “

As you probably know, ColdFusion is working on top of the Java virtual machine. Metaspace memory is used by Java to handle the representation of class metadata. The problems with metadata memory are often caused by large websites, but we saw this also for smaller servers.

The solution(s)

In the ColdFusion configuration, in the Server settings, Java and JVM you will find the JVM Arguments field. It is filled with various configuration settings for JVM (Java virtual machine). Besides others, you will find:

-XX:MaxMetaspaceSize=192m

This means that your Metaspace memory size is set to 192 MB. There are two possible solutions:

  • you can remove this setting completely
  • you can set the value to larger size

Once the setting is updated, you have to restart your ColdFusion service.

On our servers, we typically remove this setting completely. We have memory monitoring turned on one way or another, and we never experienced issues with Metaspace size.

The Metaspace is taken from the available memory of the server. It is not related to the heap space. This means that theoretically, Java can take all available memory for Metaspace. In practice, we had no issues like this. If you are afraid of giving Java so much freedom, you can adjust metaspace configuration by entering a larger number.