Highlighted

coldfusion 11 error java.lang.OutOfMemoryError: Metaspace

New Here ,
Feb 05, 2016

Copy link to clipboard

Copied

a few times a day I am getting this error - how do I fix it?

Views

3.6K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

coldfusion 11 error java.lang.OutOfMemoryError: Metaspace

New Here ,
Feb 05, 2016

Copy link to clipboard

Copied

a few times a day I am getting this error - how do I fix it?

Views

3.6K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Feb 05, 2016 0
Guide ,
Feb 05, 2016

Copy link to clipboard

Copied

Hi Shelley,

Increase the size of MaxMetaspaceSize=192m in Java JVM settings. You can edit that in CFadmin or edit

CF\cfusion\bin\jvm.config. What size? I seen folks use 512m.

CF needs to restart for the setting change to take effect.

HTH, Carl

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 05, 2016 2
Adobe Community Professional ,
Mar 26, 2018

Copy link to clipboard

Copied

Carl's reply is helpful - if you're getting out-of-memory errors, increase the amount of memory!

But in the long term, it would probably help you to understand how JVM memory management works, to understand how and why to increase JVM memory. Here's a very brief and slightly oversimplified summary.

In Java 7, the heap size (which is where variables go, and is effectively all the memory you have to worry about usually) was divided into three "generations": young, tenured and permanent. The young generation is where variables were created if they weren't expected to last long. The permanent generation is where variables were stored if they were expected to last a very long time (or forever). The space in between is where variables would end up if they survived longer than expected - they would be moved from the young to the tenured generation.

Java 8 changed this, but has some similarities. What was called the "permanent generation" in Java 7 and earlier, is now "metaspace".

Now, the important thing about this memory area is, it's used to store variables that will be around for a long time, and CF can create a lot of those variables. This is especially true if you're using a CF-based CMS. In those cases, you might want to allocate more memory to this area than you otherwise would. But doing this takes away memory from the other areas, so you might also have to increase the overall heap size as well. So it's useful, if you can, to get an idea of how much stuff you have in memory and what kind of stuff it is. If you can't do that, just increase the heap size and the metaspace a little bit at a time until the errors go away.

Dave Watts, Fig Leaf Software

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 26, 2018 0
Adobe Community Professional ,
Feb 27, 2020

Copy link to clipboard

Copied

With all do respect to Carl and Dave, I'll offer a different solution (for those who may find this, as it comes up as among the first Google results for a search on coldfusion metaspace).

 

While raising the value is indeed one solution, I argue that the best solution for most folks is simply to remove the maxmetaspacesize argument. I explain more, including why Adobe sets it (a remnant of an old situation related to maxpermsize from Java 7 and earlier) here:

 

https://www.carehart.org/blog/client/index.cfm/2020/2/24/solving_metaspace_errors/

/Charlie (server troubleshooter, carehart.org)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Feb 27, 2020 0
Adobe Community Professional ,
Mar 01, 2020

Copy link to clipboard

Copied

I agree with Charlie and have voted for his maxmetaspace bug report .

@shelley5, could you tell us what kind of application you have? What does it do?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 01, 2020 0
Guide ,
Mar 02, 2020

Copy link to clipboard

Copied

One other CF JVM idea folks like might to try is remove the reference to UseParallelGC there by selecting the Java 11 default for garbage collection (which is UseG1GC). Much the same thought process as deleting reference to Metaspace and selecting Java 11 default options.

 

As always do your own checking before and after change to know how usage is going.

 

Regards, Carl.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 02, 2020 0
Guide ,
Mar 02, 2020

Copy link to clipboard

Copied

Hi Charlie,

 

Indeed a lot has changed in 4 years with the CF Java layer. Today with CF2018 using current Java 11 one could do well to remove JVM arguments referencing MetaSpace.

 

I still think some kind of Java logging, JMX with JMC, jconsole or Java Flight Recorder could be useful to know how well the CF Java and tomcat therefore application is going.

 

Regards, Carl.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 02, 2020 0
Adobe Community Professional ,
Mar 02, 2020

Copy link to clipboard

Copied

Thanks, guys. And Carl, I do cover the value of monitoring the use of metaspace--via logs or tools--in my post. But again, most will find there's no problem with the metaspace running wild, and it was simply getting just large enough to hit the artificial limit Adobe blithely set.

 

As for the GC algo, I do agree that we should question adobe's ongoing choice of parallelgc. But the level experience of using g1 with cf is still rather small.

 

More than that, I would argue that few have GC problems. I know it can seem that it's rampant, but really it's not. Here again, diagnostics could help one know if it's an issue worth worrying about.  I'm just saying that for most it's not.

 

And that's all the more reason why we don't see much experience with changing the GC algo, let alone tweaking other GC args. 

/Charlie (server troubleshooter, carehart.org)

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 02, 2020 0