cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-2985) Memory leak when initializing CXF throughSpring
Date Tue, 01 Nov 2011 20:31:34 GMT

    [ https://issues.apache.org/jira/browse/CXF-2985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13141540#comment-13141540
] 

Daniel Kulp commented on CXF-2985:
----------------------------------

The last release of 2.1.x was on Jun 1st 2010 which was a few months before this.  So out
of support by the time the bug was reported and fixed.
                
> Memory leak when initializing CXF throughSpring
> -----------------------------------------------
>
>                 Key: CXF-2985
>                 URL: https://issues.apache.org/jira/browse/CXF-2985
>             Project: CXF
>          Issue Type: Bug
>          Components: Bus
>    Affects Versions: 2.2.10
>            Reporter: Mauro Molinari
>            Assignee: Daniel Kulp
>            Priority: Critical
>             Fix For: 2.2.11
>
>         Attachments: Patch_CXF-2985.patch
>
>
> As described in a comment of bug CXF-2164, there's still a case of memory leak produced
by CXF when embedded into a web application and initialized through Spring.
> The problem is that cxf.xml declares the following bean:
> <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl"/>
> Here, the destroy-method is not declared. This means that when Sping shuts down the context,
it does not call any shutdown method on the CXFBusImpl.
> The net result is the following:
> - Tomcat starts
> - Tomcat starts my web application
> - this declares a Spring web application context that gets parsed
> - at some point cxf.xml is parsed, so the bean named cxf is created and an org.apache.cxf.bus.CXFBusImpl
instance is created using the constructor org.apache.cxf.bus.CXFBusImpl.CXFBusImpl(Map<Class,
Object>), which causes the org.apache.cxf.BusFactory.localBus ThreadLocal to be assigned
a value of this type, through a call to org.apache.cxf.BusFactory.possiblySetDefaultBus(Bus);
I see that this happens in a thread called "main"
> - if I stop the web application, Spring closes down the context; however, as I said before,
this does not cause any shutdown method of the cxf bean to be called
> - so there's no null-setting or removing operation of the org.apache.cxf.BusFactory.localBus
ThreadLocal for the thread "main"
> The problem of the use of a ThreadLocal is that even if the shutdown method od CXFBusImpl
were called, the shutdown operation may be done in a thread which is different from the one
in which the context had been created.
> As suggested by Daniel Kulp in the other report, maybe the best solution is to use a
WeakHashMap<Thread, Bus> to keep the thread-bus relationships.
> I'm going to provide a patch.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message