[jacorb-developer] Undeploying webapp in tomcat

Richard McAleer richard.mcaleer at caris.com
Fri Feb 12 15:46:34 CET 2016


Hi,

I have a webapp using jacorb as a client to a TAO server.  I've been 
looking into cleaning up memory leak warnings logged by tomcat 
(http://wiki.apache.org/tomcat/MemoryLeakProtection) when undeploying 
the webapp and running into a couple of issues around that with jacorb.

Some of the threads reported by tomcat are the ClientMessageReceptor 
threads from jacorb.  I was able to get those cleaned up by calling 
shutdown(true) on the orb; however, it will only work if I put a call to 
Thread.sleep() after the orb is shutdown.  If I don't put that call, the 
threads are still terminated, but not before tomcat tries to clean up 
the WebappClassLoader and logs warnings about those threads.  I use 
ORB.shutdown(true) so it will wait for threads to complete, but the 
ClientConnectionManager doesn't use the wait_for_shutdown flag, so 
there's no guarantee those threads will be terminated before tomcat does 
it's cleanup.

So, I'm wondering if there's another way I could get it to wait for the 
shutdown process to complete instead of using Thread.sleep() with an 
arbitrary sleep time?

The other problem I'm seeing is these log messages:

11-Feb-2016 15:06:43.549 SEVERE 
[ContainerBackgroundProcessor[StandardEngine[Catalina]]] 
org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks 
The web application [] created a ThreadLocal with key of type 
[org.jacorb.orb.Delegate$2] (value [org.jacorb.orb.Delegate$2 at 20484664]) 
and a value of type [java.util.ArrayDeque] (value [[]]) but failed to 
remove it when the web application was stopped. Threads are going to be 
renewed over time to try and avoid a probable memory leak.
11-Feb-2016 15:06:43.549 SEVERE 
[ContainerBackgroundProcessor[StandardEngine[Catalina]]] 
org.apache.catalina.loader.WebappClassLoaderBase.checkThreadLocalMapForLeaks 
The web application [] created a ThreadLocal with key of type 
[org.jacorb.orb.Delegate$1] (value [org.jacorb.orb.Delegate$1 at 3df575ac]) 
and a value of type [java.lang.Boolean] (value [false]) but failed to 
remove it when the web application was stopped. Threads are going to be 
renewed over time to try and avoid a probable memory leak.

We have some custom idl objects that we use for communicating with 
back-end C++ services from our java code.  I think they're all being 
cleaned up as part of our shutdown process, so I would think the 
delegates they use would be cleaned up.  Is there anything I 
could/should be doing to ensure those ThreadLocals are removed?

Thanks,
Richard


More information about the jacorb-developer mailing list