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

Amichai Rothman commented on CXF-5188:
--------------------------------------

The main leak turns out to be higher up the stack in ServerFactoryBean - when a 
server is initialized successfully but then throws an exception when started 
(such as the one above), the exception is propagated and the server is not 
properly disposed of. I fixed it to first destroy the server before propagating 
the exception.

After this fix the main leak (which was easily recreated on almost every 
restart) is closed, but there's still another leak somewhere that's harder to 
recreate, I've seen it a couple of times and haven't tracked it down yet - I'll 
open a separate issue when I have more details.
                
> Leaks in ServiceImpl when stopping/restarting bundles
> -----------------------------------------------------
>
>                 Key: CXF-5188
>                 URL: https://issues.apache.org/jira/browse/CXF-5188
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.7.2
>         Environment: Karaf 2.3.2, DOSGi 1.6.0-SNAPSHOT
>            Reporter: Amichai Rothman
>         Attachments: ServiceImpl_leak_snapshot.png
>
>
> I've been looking at VisualVM heap dumps after restarting some custom bundles 
> in Karaf and noticed the stopped services (exported via DOSGi) linger in 
> memory and are never garbage collected (screenshot attached, StoreServiceImpl 
> being the lingering custom service). Browsing through the instance hierarchy 
> from the snapshot I found something suspicious - 
> org.apache.cxf.endpoint.ServiceImpl registers the ManagedEndpoint with the 
> ServerLifeCycleManager, but doesn't seem to unregister it when the instance 
> is destroyed. Could this be the memory leak preventing the old bundles from 
> being collected?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to