On top of all that's been said, I'd add this:

Yes, it's likely that you simply need to increase the maxpermsize. Sometimes
just another 100-300 can be enough to solve the problem.

But you also want to make sure that this is really the *first* error that
puts CF into a bad state. It could be that something else precedes it and
precipitates it.

Look in in the [cf]\runtime\logs\, in its out log for this instance, at the
time of your crash, and look back in that log (before the crash) to see if
any other errors or unusual messages show up. If you see none for 1-20
minutes before that permgen message, then that alone would seem to be the
problem.

As to how it could happen, you're on the right track but not quite right in
what you've concluded. The saving of class files is not quite connected as
you think. That's about compiling, where the permgen is about loading. CF
loads classes into the template cache (and thereby the permgen, when they're
first requested--and are not in the cache already, or later when it's no
longer in the cache for any reason, including a restart. A class can be
removed from the template cache also during the life of the server when the
template cache becomes full and it needs to make room for a more newly
requested one, by removing the least recently used one). 

And CF will obtain that class (to load when needed) either by compiling it
from source on the fly, or by pulling it from that cfclasses directory (if
you have enabled that "save class files" option in the Admin).  

So how does the permgen get stressed? Most often by excessive loading of
templates into the template cache. Again, when it gets full, it removes the
oldest to make room for new ones. How could it get full? Because the number
of templates that need to be loaded (CFM files, CFCs,  and indeed a class is
created for each METHOD in a CFC) exceeds its size. The default is 1024.
That's also not a hard cap. There is a soft cache on top of that.  

If you look in the cfclasses directory, see how many files are there. You
might even sort it by date modified and see how many are recently edited. If
that number is at or near 1024, it's likely your app uses lots of files and
therefore creates lots of classes, which can then cause this stress. If you
increase the size of the template cache, beware that that cache is stored in
the heap, so you may need to raise that, too. (Yes, loading things into the
template cache then affects both the heap and the permgen, from my
observation.)


Does that make sense, does that help? You're right, you don't find much out
there about it. Hope this is helpful. I may blog it once we have some back
and forth. (I've hinted at this info in some entries, but not devoted one to
it.)



/charlie

 

From: ad...@acfug.org [mailto:ad...@acfug.org] On Behalf Of Cheyenne
Throckmorton
Sent: Tuesday, December 06, 2011 10:09 PM
To: discussion@acfug.org
Subject: [ACFUG Discuss] PermGen CF Server Memory Errors

 

One of our CF servers keeps needing to have the CF service rebooted on it in
order to work and continue serving our sites 1-2x / week.  Fortunately we do
have a web service on one of the other box that monitors this machine to let
us know when it starts bugging out again.

 

The error I am getting on the server has to do with an out of memory perm
gen space issue, something that there is tons of stuff online about but
nothing that I've been able to succinctly tell is a good idea to look toward
resolving the issue.  Here are the errors we get before the service fails.

 

javax.servlet.ServletException: ROOT CAUSE:  java.lang.OutOfMemoryError:
PermGen space

 

12/06 16:24:46 Error [jrpp-3954] - PermGen space The specific sequence of
files included or processed is:
F:\...................\case-studies\ENDO-enduring-hot-seat-discussion\index.
cfm''

12/06 16:24:46 error ROOT CAUSE: java.lang.OutOfMemoryError: PermGen space

 

javax.servlet.ServletException: ROOT CAUSE: java.lang.OutOfMemoryError:
PermGen space

 

Server: Windows Server 2008 R2 64bit

ColdFusion  9,0,1,274733 Standard

Java Version:  1.6.0_24

RAM 8GB 





 

JVM Arguments

-server -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m
-XX:+UseParallelGC -Xbatch -Dcoldfusion.rootDir={application.home}/../
-Dcoldfusion.libPath={application.home}/../lib




        

Despite my attendance of multiple Charlie lectures and/or because of such
attendance I certainly do not consider myself an expert in the memory
underpinnings of CF.  What I do believe is happening through some research
and late night testing is that essentially the server stores information (in
think in cfclasses) that is essentially compiled java code.  It does this to
speed the delivery of data generated by CF in a caching like mechanism.  

 

There is a checkmark in the settings that says "Save Class Files" which I
suspect would solve the problem if indeed this area is getting overflowed
and not properly Garbage Collected (if GC even runs in PermGen).  However,
unchecking that is not recommended for a production machine, and it would
obviously slow down all of the sites.  Similarly I've seen posts that say to
just increase the MaxPermSize, but I find many posts after those saying that
is not solve and just delaying the problem.  I'd rather solve the problem.

 

Additionally, when observing the websites when it is acting up we get a lot
of totally blank pages along with 200 OK http response codes.  I have also
gotten partial pages at times, but that all leads me to some sort of partial
template loading until the permgen runs out of memory.

 

Finally, I don't know that it is a 100% deal, but we have launched a new
application on this server that makes use of the new ORM Hibernate
functionality.  This happened right around the same time we started
observing these issues.  This was my first shot at ORM within CF and I know
I need to go back and re-look at how I have the lazy-loading set up.  I have
a feeling that it can definitely be tuned better and that it's possible this
type of code may make heavy use of the permgen space with dynamically
loading data in the way that it works.  This heavy banging in the permgen
along with an untuned JVM may be the combo that is causing our problems, or
maybe I'm way off.  Figured I'd throw it out there to group to see what
thoughts and solutions might be out there beyond my teams continued googling
of words like "permgen", "coldfusion", "hibernate", "orm" and "arehart" :)

 

- Cheyenne Throckmorton


 

P.S. Looking forward to seeing folks at Whirlyball tomorrow night.


-- 
Cheyenne Throckmorton - Atlanta, GA
Blog      : www.CheyenneJack.com
Twitter   : @cheyennejack
Founder : www.AtlantaUserGroups.com
               www.TheTallStreetJournal.com
               www.MohawksRock.com




-------------------------------------------------------------
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to