Wednesday, August 4, 2010

GroovyPagesTemplateEngine memory leak/ Perm Gen space issue

  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 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).