1 minute read

For quite a while I’m facing the well-known problem of memory leaks while re-deploying Axis2 Webservices on Tomcat and JBoss.

The problem is that you run out of memory, the PermGemSpace in fact, after some redeploy cycles of an Axis2 based Webservice. The only solution is to restart the server to clean up the memory. While this is not too hard on a development machine, it’s more difficult on a production server. Although you most probably won’t deploy on a production server too often, it’s getting on my nerves.

Today I had some time to spare for this memory leak search. I started the search with the error message that my Tomcat 6.0.32 gave me.

A web application appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak

After a while I found a thread about Axis2 memory leak. The first hint was to use arit to get a more detailed view what’s going on. The error message wasn’t very clear, but in the mentioned thread Andreas noted the bug AXIS2-4263 where Andreas Veithen (the same that is doing arit?) suggested to disable the scripting module.

At first I simply removed the entry in the WEB-INF/modules/modules.list, but that wasn’t sufficient, at least for me. Removing the scripting-1.5.4.mar finally solved the problem.

Sigh!

BTW: Tomcat 7.0.12 and JBoss 4.2 show the very same behaviour. They can’t fully GC the re-deployed WAR.