Wednesday, August 4, 2010

GroovyPagesTemplateEngine memory leak/ Perm Gen space issue

Hi,
  Was working on to resolve one of the issues that our production server was getting while running Grails based application which uses org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine for templating etc.
  Actually it turned out to be a very serious issue. when we digged into the issue and found that while creating dynamic classes by compiling the templates, it keeps on using more and more memory if there are many requests comming to the application (no matter how fast/slow) which uses org.codehaus.groovy.grails.web.pages.GroovyPagesTemplateEngine.createTemplate(Resource) method.
  After sometime it used to full whole our PermGen space (1 GB as well very easily under load) causing application to stop responding any further requests.

  That forced us to go through the Grails code and luckily we were able to resolve the issue.
We have created Grails Jiras for the same as provided link below:
   1.  http://jira.codehaus.org/browse/GRAILS-6573
   2.  http://jira.codehaus.org/browse/GRAILS-6571

 

Refs:
http://markmail.org/message/y67xrhy3foy4rfqe#query:+page:1+mid:gm7ms4ljghqql2ei+state:results
http://www.nabble.com/MetaClassRegistryImpl-memory-retainment-and-1.5.7-td19979094.html#a20040179

1 comment:

Ted Naleid said...

Thanks for the post, we hit a similar memory leak issue with how we were using the GroovyPagesTemplateEngine and your post helped us track down what the issue was (with the associated JIRA defects).