views:

456

answers:

3

I'm looking for a hint how to make tomcat CI ready or an servlet container / application container which stand often redeploys like they happen when using hudson ci.

I experienced that Tomcat 6 does not properly undeploy webapps, leaving classes in jvm.

For example I monitored tomcat 6 with VisualVM: on start 2000 classes, on deploy of an app 3000 after redeploy 4000 and redeploy 5000 classes and so on - leading to crashes, memory leaks...

Okay hope one have a hint on tomcat and continuous-integration or other app servers.

+1  A: 

I always like to take drastic measures to make sure that everything is clean and in a fully reproducible state when starting

1) kill tomcat

2) delete it from disk

3) unzip a clean version

4) overwrite your personalized modified configured files

5) restart tomcat

6) deploy your app

flybywire
Thanks, we've use fresh clean tomcat for tests, no tinkering applied, thats not exactly the point...
jpse
+5  A: 

Update : I've performed some tests with a moderately complex web application using Spring, Hibernate, GWT, C3P0 and HsqlDB.

Stock Tomcat 6.0.24 works just fine , provided you use the client compiler. It works on ten redeploys, whereas the server compiler breaks down on the fourth. I suggest you try with the -client flag.

Trying to debug the usage of the server compiler was fruitless, as the Eclipse MAT showed no GC roots for the classloaders, and yet they were retained. An oft-referenced bug , PermHeap bloat in and only in server VM was reportedly fixed in Java 6 update 16, but my tests fail with Java 6 update 16.


Tomcat has been checked and double-checked for such memory problems, and quite often the applications were to blame. No that is not to say that it's necessarily hard to have such a perm gen leak.

There are two possibilities here:


If you actually want to debug this problem and make sure that it's Tomcat's fault, you can you the Eclipse memory analyser. They have a good blog post explaining how to debug PermGen problems.

Robert Munteanu
Hi, you said GCC is broken... What do you exactly mean by that. Is there any test?anyway, yes indeed application often causing the trouble, thats why we use sample apps like they uses million times. The new leak detection feature unfortunately not solving the problem but is a nice step in the right direction and helping hand to understand whats going on...
jpse
Yes, the GCC reference is quite opaque, sorry. What I mean to say is that we as developers have a tendency to blame other components - application server, OS, cosmic rays :-) for problems which we can't explain and . I've done this too many times, and almost always found the fault in my code.
Robert Munteanu
@Robert thank you for the eclipse link
jpse
@Phillip: see my update.
Robert Munteanu
@Robert You are digging deep, what do you meean excatly with use the client compiler, where to set that flag?
jpse
@Phillip: the client compiler is selected when you pass the `-client` argument to the java invocation. For Tomcat this can be set in `CATALINA_OPTS`.
Robert Munteanu
@Robert I tested the -client flag in windows and linux environment, both with no impact...
jpse
@Phillip : then your only solution is to use the Memory Analyser ( or a commercial profiler) and see where the leak is. It might be Tomcat or it might be your applications.
Robert Munteanu
A: 

Take a look at Apache Cactus - it's a framework for server-side in-container unit testing. It works pretty much with any servlet container.

Slava Imeshev