February 25, 2020
How to quickly solve outofmemory metaspace errors
Comments
(8)
February 25, 2020
How to quickly solve outofmemory metaspace errors
ColdFusion troubleshooter
Wizard 146 posts
Followers: 115 people
(8)

[Originally written Feb 2020, updated Feb 2021]

Update: Since posting this, I can announce that CF2021 does in fact no longer offer this maxmetaspace arg by default. That’s great! But if you are on CF2018 or earlier (and Java 8 or later), then the below still applies. (Also, if you migrate into 2021 the admin settings from a previous version which did set it, the arg will be brought in then, so again the below would still apply.)

Have you been annoyed to find CF failing with outofmemory errors referring to “outofmemoryerror: metaspace”, or more simply just “metaspace”. Or you may get strange cases of CF pages simply “returning blank”, and if you look into CF’s coldfusion-error.log file, you may see this metaspace error appearing then.

You may google the problem and find folks helpfully suggesting that you increase CF’s JVM argument related to this (whatever size you see):

-XX:MaxMetaspaceSize=192mb

I will suggest instead that for most folks you should simply REMOVE this argument entirely. Most folks simply don’t need this set, but Adobe sets it for us to a small default value, for reasons related to previous Java versions. You do need to be careful about that. Remove all of it, from the – to the mb. I would also recommend you remove it by editing the jvm.config rather than in the CF Admin (in case you make a mistake, and a CF restart could then fail and you’d not be able to get to the CF Admin.)

If you want to find out more on why I suggest removing it, how to do it safely, and more, see the blog post on my own site with much more information, here:

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

I also offer there a link to a bug report where I make the case that Adobe should also stop setting this value for us.

(Again, as an update, since I posted this, Adobe HAS removed the arg in CF2021, for new installs. It may still import any that existed in a previous CF version that was migrated in.)

Finally, I address as well the question of whether one might ever WANT to set a higher value, as well as how to MONITOR the use of metaspace, and more.


For more blog content from Charlie Arehart, see his posts here as well as his posts at carehart.org. And follow him on Twitter and other social media as carehart.

8 Comments
2020-04-22 18:35:08
2020-04-22 18:35:08

Here’s some good news on this matter: I got a notification just today (on that feature request in tracker) that Adobe is scheduling to remove the arg in CF2020, as of an upcoming beta release. Yay. 🙂

And let that be a lesson to those who say Adobe “never pays attention to issues in tracker”. With dozens of bug fixes at least, in every couple of updates, they clearly do–let alone what may have to wait for a new release.

And no, it’s not because “it was you, Charlie, reporting it”. There are issues I have reported that are not fixed. I’m not saying they fix EVERYTHING. I’m contending against those who try to assert they don’t seem to fix ANYTHING. It’s just not true.

Like
(1)
2020-04-22 12:47:27
2020-04-22 12:47:27

Ok, I am not able to add an image, but in the question should be clear I guess: should I remove from the hyphen to the “m”: -XX:MaxMetaspace=192m?

Like
(1)
>
Daniel Szwarc
's comment
2020-04-22 18:28:56
2020-04-22 18:28:56
>
Daniel Szwarc
's comment

Yes, Daniel. And as I noted in the post above, I cover things in more detail in the post on my own blog. In particular, see the subsection there, “How to remove the argument, carefully”. But you got it, yes, from the – to the m.

And as you repeated your question, in the hassle you had adding an image, I will repeat this answer there, in case someone someone would expand one but not both of these versions of your question.

Like
2020-04-22 12:41:48
2020-04-22 12:41:48

Good morning Charlie and thank you for this post.

Question: do I need to remove it from the hyphen to the m, like in the image?

Will this restart the ColdFusion Service?

 

Like
(2)
>
Daniel Szwarc
's comment
2020-04-22 12:45:53
2020-04-22 12:45:53
>
Daniel Szwarc
's comment

Here is the image

Like
>
Daniel Szwarc
's comment
2020-04-22 18:31:21
2020-04-22 18:31:21
>
Daniel Szwarc
's comment

Never saw the image. Not sure what happened there.

But yep, Daniel: from the – to the m. And as I noted in the post above, I do cover things in more detail in the post on my own blog. In particular, see the subsection there, “How to remove the argument, carefully”, where I addressed that and showed it specifically.

Finally, as you repeated your question here, given the hassle you had adding an image, I will repeat my answer in both places, in case someone someone would expand one but not both of these versions of your question.

Like
2020-02-28 19:47:34
2020-02-28 19:47:34

I voted! 

Like
2020-02-25 18:13:16
2020-02-25 18:13:16

Wow…thanks, Charlie.

Like
Add Comment