Perm Gen Space

anyone have error message like this? my app is very slowly :disappointed_relieved:

2017-11-27 15:14:24.801  Free Perm Gen Space is less than 5% free: shrinking all template classloaders : consider increasing allocated Perm Gen Space

i have already set memory on tomcat/bin/setenv.sh

#! /bin/sh

export CATALINA_OPTS="$CATALINA_OPTS -Xms512m"
export CATALINA_OPTS="$CATALINA_OPTS -Xmx6024m"
export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=1024m"

my physically memory is 8GB, my server is ppc64 using rhel and i install lucee using 5.2.3.35.war.

Firstly, is there a reason youā€™re not on Java 8 yet? As for your error messages, sounds like something is loading Java classes over and over again.

For starters are you using Javaloader? Always always always make sure you cache your javaloader instance in the server scope and donā€™t recreate it. The next thing is are you using TestBox with heavy mocking/stubbing or WireBox AOP on transients. Either of those can sometimes create a large number of new class files due to the way they create .cfm templates and cfinclude them on the fly.

And finally, use a tool like FusionReactor to monitor your permgen space and see if the jumps correspond with any particular scheduled tasks or jobs on your server.

3 Likes

Firstly, is there a reason youā€™re not on Java 8 yet? As for your error messages, sounds like something is loading Java classes over and over again.

iā€™m using ibm-java-sdk-8.0-5.5-ppc-archive.bin

For starters are you using Javaloader? Always always always make sure you cache your javaloader instance in the server scope and donā€™t recreate it. The next thing is are you using TestBox with heavy mocking/stubbing or WireBox AOP on transients. Either of those can sometimes create a large number of new class files due to the way they create .cfm templates and cfinclude them on the fly.

I donā€™t know how to configure it. Can you give me sample, pleaseā€¦

And finally, use a tool like FusionReactor to monitor your permgen space and see if the jumps correspond with any particular scheduled tasks or jobs on your server.

ok, iā€™ll try to use this tool.

iā€™m using ibm-java-sdk-8.0-5.5-ppc-archive.bin

You may have that installed, but Iā€™m pretty sure you wouldnā€™t be getting any logging related to perm gen space if you were on Java 8ā€¦ Dump out the server scope in your app to confirm what version of java is being used.

I donā€™t know how to configure it. Can you give me sample, pleaseā€¦

Configure what? I listed 3 different libraries. Are you using any of those libraries?

This is my java information:
java_ibm

For library iā€™m using cfspreadsheet with inspect Once and for coding iā€™m never using Javaloder.

This log always show up until now, i donā€™t know what wrong with my lucee config

2017-11-27 15:14:24.801 Free Perm Gen Space is less than 5% free: shrinking all template classloaders : consider increasing allocated Perm Gen Space

Ahh, I found where that error is coming from. Itā€™s coming from Lucee itself, not the JVM which explains a lot. You have no perm gen space at all, but Lucee hasnā€™t been adjusted fully for Java 8 and it still has a permgen check in place. Iā€™m honestly a little curious what the heck itā€™s measuring on your Java 8 system. From the looks of the SystemUtil class, itā€™s looking over a bunch of MemoryPoolMXBean classes for one that has a specific name in the title.

I put in this ticket:
https://luceeserver.atlassian.net/browse/LDEV-1598

What does FusionReactor show for your memory spaces?

I just started getting this error. Only thing I did was download the OpenJDK 11.0.1+13 from the adoptopenjdk.net site, unzip and point Tomcat to it. The stderr log fills up wit this error without ever even hitting Lucee.

Iā€™d already been using Tomcat 9.0.12 and OpenJDK 11.0.1 GA from JDK 11 Releases on several other machines without trouble.

The only difference is that the machine having issues is a 32b Windows machine, the others are 64b Windows machines. AdoptOpenJDK has a Windows 32b version and other sites do not.

I am running Lucee 5.3.2.17-SNAPSHOT (not updated beyond that due to this issue:
Redirecting to Google Groups)

When upgrading Lucee to any SNAPSHOT above Lucee 5.3.2.17-SNAPSHOT, our site gets this error:
Type: java.io.IOException Messages: org.osgi.framework.BundleException:Bundle symbolic name and version are not unique: TOMCAT_9_0_12:0.0.0

Is anybody else seeing this with OpenJDK 11.0.1+13?

Gotta admit, Iā€™m really surprised to see this. Any particular reason youā€™re still running 32b here? Supporting an additional bit type is a lot of work, thereā€™s very little demand for it, and thereā€™s no Adopt 32b Java 11 build for Linux. Due to these factors, I just stopped doing 32b builds for the installers.

Are you using ancient hardware or software that still requires 32b? Would be interested to know your reasons for continuing to run 32b in your environments.

The current Lucee 5.3 installer builds are also running Tomcat 9 and Adopt Java 11. They passed my initial tests, but we havenā€™t used them too much yet in production environments. That said, we havenā€™t had issues with them either. My guess is that your issue is related to your 32b system or JRE.

Thanks Jordan. The production servers are all 64-bit machines, so thereā€™s no problem there. However, the companyā€™s dev workstations are all 32b as the companyā€™s CRM, ERP, etc. software are ancient DOS-based FoxPro applications. Thereā€™s no way to get off of the FoxPro app.

The irony is itā€™s a computer hardware manufacturer, so all hardware is beyond state of the art. The PC used by the average secretary for email could probably run a small 3rd world country! We are in the heart of Silicon Valley and you would be absolutely amazed at how many big tech hardware companies (all whose names you know quite well!) are running DOS-based software applications!

Anyways, thereā€™re plenty of workarounds such as having separate dev workstations, etc. but I was trying to understand why this might be happening?

Just to be clear, is this message in the logs actually causing you issues or are you just trying to remove it? The message

Free Perm Gen Space is less than 5% free: shrinking all template classloaders : consider increasing allocated Perm Gen Space

is really more of a warning than an error, and if youā€™re on Java 8+ plus you donā€™t even have a perm gen space so you can probably just ignore it. Analyze your memory spaces and if they are healthy (especially you rmetaspace) then I wouldnā€™t worry about it warning.

I havenā€™t noticed a specific issue other than crashing Notepad++ when trying to load the std err log due to its size! That error fills up continuously for nearly a million lines.

The issue is that the tomcat9-stderr.2019-01-02.log (so created 5 days ago) is at 135MB on a machine where the Tomcat service is running, but no apps, etc. are hitting it, so it just seems to grow non-stop?

You said the error comes from Lucee itself, so is there a way to turn off that warning?

Yes, log files of that size does seem like an issue. Looking at the logic, there does not appear to be any way you can disable the setting. There is a permGenCleanUpThreshold that starts at 60 but regardless of what you set it to, Luee will slowly decrease it by 5 until it reaches 5 at which point your message begins appearing in the logs. The output also bypasses any log4j settings which would allow you to disable the logging of the message because it prints directly to the system.out.

I think your only recourse is to lobby for the tiket I posted above to get fixed. I am curious however if you do have a memory space that is running low and which on it is. it appears if you donā€™t have a memory space with a name that looks like perm gen, Lucee simply grabs the first non-heap space it can find and if that fails, it grabs any memory bean called ā€œClass memoryā€.

Voted.

On a related note, here is the ticket for Adopt to start providing LInux 32 bit builds for their OpenJDK builds. Freel free to vote on it if 32 bit Linux is a need for you.

2 Likes

@Leftbower I almost forgot-- I searched the Lucee JIRA yesterday and I couldnā€™t find a ticket for this error:

When upgrading Lucee to any SNAPSHOT above Lucee 5.3.2.17-SNAPSHOT, our site gets this error:
Type: java.io.IOException Messages: org.osgi.framework.BundleException:Bundle symbolic name and version are not unique: TOMCAT_9_0_12:0.0.0

@micstriit 's rule is if a bug isnā€™t in JIRA, it doesnā€™t exist :slight_smile: And he doesnā€™t read every post here so he possibly doesnā€™t even know about it. Can you enter a ticket?

lol

Itā€™s interesting reading some of the comments in that thread. If thereā€™s still a healthy demand for the 32b builds, Iā€™m okay with continuing to build and test 32b installers. I just didnā€™t want to invest the time if it wasnā€™t an actual need there.

I will do this when I get in and link it here.

1 Like

Bug filed: LDEV-2132

1 Like