John Trimble (JIRA)
Thu, 21 Jan 2010 02:59:47 -0800
[
http://issues.ops4j.org/browse/PAXWEB-191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13293#action_13293
]
John Trimble commented on PAXWEB-191: ------------------------------------- Oh wow, that is pretty cool. I actually had no idea what OPS4J stood for. I apologize, I should of read through the OPS4J docs for contributors before posting this issue. Thank you for taking the time to put me on track. > When a bundle registered with Pax Web is uninstalled, references to that > bundle's objects are not properly cleaned up causing a memory leak. > -------------------------------------------------------------------------------------------------------------------------------------------- > > Key: PAXWEB-191 > URL: http://issues.ops4j.org/browse/PAXWEB-191 > Project: Pax Web > Issue Type: Bug > Components: Http Service, War Extender, Web Container > Affects Versions: 0.7.2 > Environment: Apache Felix Karaf 1.2.0 and Pax Web 0.7.2 > Reporter: John Trimble > Assignee: John Trimble > Attachments: bundle_uninstallation_leak_fix.patch, memoryhogwebapp.zip > > > Pax Web continues to hold object references to uninstalled bundles that had > registered with the Pax Web WebContainer service or were extended by the Pax > Web War Extender. This causes a memory leak leading to permanent generation > and heap space issues if bundles, which interact with Pax Web in the > aforementioned ways, are routinely installed and uninstalled. > With regard to the WebContainer service, instances of > org.ops4j.pax.web.service.internal.HttpServiceStarted are never garbage > collected once instantiated and potentially continue to hold references to > various objects from uninstalled bundles, such as ServletContextListener > instances, if they were not explicitly unregistered. The cause of this is > that newly instantiated instances of HttpServiceStarted add a ServerListener > instance, implemented as an anonymous inner class of HttpServiceStarted, to > the ServerController, but never remove it. This listener holds an implicit > reference to the HttpServiceStarted instance preventing its garbage > collection, and the garbage collection of anything it references. > The Pax Web War Extender's WebXmlObserver holds references to instances of > org.ops4j.pax.web.extender.war.internal.model.WebApp even after the > associated WAR has been uninstalled. This leads to the same issue regarding > permanent generation and heap space. > I've attached a patch that should plug both of these leaks. First, it adds > the ability to remove ServerListener instances from a ServerController, and > modifies the HttpServiceStarted's stop() method to remove the appropriate > ServerListener instance from the ServerController. Secondly, it modifies the > WebXmlObserver's removingEntries() method to remove the appropriate WebApp > reference. > In addition to the patch, I've included a small example webapp to help > illustrate the problem. Simply install and uninstall the WAR serveral times, > allowing the Pax Web War Extender to extend it, and an OutOfMemory exception > will soon follow. If you examine the heap space, using a tool like YourKit, > you will find outstanding references to MemoryHogServletContextListener > instances, as well as extraneous WebApp and HttpServiceStarted instances. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.ops4j.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira _______________________________________________ general mailing list general@lists.ops4j.org http://lists.ops4j.org/mailman/listinfo/general