Coherence objects not released when undeploying application?
612753Dec 10 2007 — edited Feb 11 2008Hi
Part of our continuous integration build is deploying our application to a Weblogic server and running some selenium test cases against it. We have usually about 15 builds running each day.
Our problem is that we seem to be experiencing a memory leak in that process; each new build takes more and more memory until weblogic starts throwing out-of-memory errors (as a workaround we'r restarting weblogic every night).
After spending some time using a profiler (we'r using YourKit Java Profiler) it appears that the calls to Coherence libraries cause references to our objects not being properly released and GC is not able to get rid of them properly. If the calls to the Coherence libraries are removed teh GC correctly releases all our application objects.
To confirm this I have created this simle test scenario:
1. Created an empty web application (war) that has only one class in it:
package com.test;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import com.tangosol.net.CacheFactory;
public class TestServletContextListener implements ServletContextListener {
public void contextDestroyed(ServletContextEvent arg0) {
CacheFactory.shutdown();
}
public void contextInitialized(ServletContextEvent arg0) {}
}
2. Modified the web.xml to register the ContextListener:
<listener>
<listener-class>com.test.TestServletContextListener</listener-class>
</listener>
3. Created empty EAR that has only two libraries in it: coherence.jar & tangosol.jar (version 3.3.1)
5. included the test web application in the EAR (no other classes, projects or libraries are included; no other configuration settings are adjusted from defaults)
6. While using the profiler I was performing deployemnt and undeployment of teh EAR against the Weblogic server. With each new deployment a new set of com.tangosol* classes is created. Those classes are not released even when GC is forced from the profiler.
I'm not able to attach a screenshot from the profiler to this post, but with each redeployment I can see the following objects created (ordered with number of objects created in a descending order):
com.tangosol.util.Base$ComonMonitor: 1024 new objects
com.tangosol.run.xml.XmlToken: 16 new Objects
com.tangosol.util.ListMap: 11 new Objects
com.tangosol.util.RecyclingLingedList$Node: 5 new Objects
etc.
Am I doing something wrong or is there really a problem with the object references not properly released in Coherence?
thank you
s.