Tomcat Perm-Gen OutOfMemoryErrors and restarting

Hi all,
There was a discussion weeks back about restarting Tomcat after every
deploy to prevent PermGen OutOfMemoryErrors.

It trigger a memory about what causes these so here are some resources:


http://www.jroller.com/agileanswers/entry/preventing_java_s_java_lang
http://stufftohelpyouout.blogspot.com/2011/05/diagnosing-webappportlet-hot-deploy.html

I have no idea if these actually work but may help.

Cheers,
Edward

On 12.09.2011, at 14:50, Edward Sargisson wrote:

Hi all,
There was a discussion weeks back about restarting Tomcat after every
deploy to prevent PermGen OutOfMemoryErrors.

you can check the current amount of used memory and work from that.
I implemented that some time back with snmp:

essentially requesting a restart of tomcat before deployment if the remaining PermGen size is not big enough:

    if ((perm_gen_max - perm_gen_used) < min_perm_gen) #node[:tomcat][:permgen_min_free_in_mb])
      Chef::Log.info "SNMP reported: PermGen Max:#{perm_gen_max/1024/1024} PermGen Used:#{perm_gen_used/1024/1024} , diff: #{(perm_gen_max/1024/1024 - perm_gen_used/1024/1024)}  is lower than #{min_perm_gen/1024/1024} "
      @new_resource.service.run_action(:restart)
      poll_manger_until_running
    end

It trigger a memory about what causes these so here are some resources:
exception - Dealing with "java.lang.OutOfMemoryError: PermGen space" error - Stack Overflow
Casinonic Australia – how to get much pleasure?
http://stufftohelpyouout.blogspot.com/2011/05/diagnosing-webappportlet-hot-deploy.html

I have no idea if these actually work but may help.

Cheers,
Edward

--
DI Edmund Haselwanter, edmund@haselwanter.com, http://edmund.haselwanter.com/
http://www.iteh.at | Facebook | http://at.linkedin.com/in/haselwanteredmund