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

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

In addition, ServiceImpl adds a listener to the bindingFactory, but never 
removes it. That might explain exceptions that appear when restarting bundles. 
I'm not familiar with these mechanisms, so if someone in the know could have a 
look at ServiceImpl and make sure all the resources/listeners are properly 
managed, that would be great!

java.lang.RuntimeException: Soap 1.1 endpoint already registered on address 
http://192.168.1.100:9000/com/example/MyService
        at 
org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFactory.java:921)
        at 
org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:131)[142:org.apache.cxf.cxf-api:2.7.2]
        at 
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:204)[150:org.apache.cxf.cxf-rt-frontend-simple:2.7.2]
        at 
org.apache.cxf.dosgi.dsw.handlers.AbstractPojoConfigurationTypeHandler.createServerFromFactory(AbstractPojoConfigurationTypeHandler.java:191)[161:cxf-dosgi-ri-dsw-cxf:1.6.0.SNAPSHOT]
        at 
org.apache.cxf.dosgi.dsw.handlers.PojoConfigurationTypeHandler.createServer(PojoConfigurationTypeHandler.java:119)[161:cxf-dosgi-ri-dsw-cxf:1.6.0.SNAPSHOT]
        at 
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportInterfaces(RemoteServiceAdminCore.java:184)[161:cxf-dosgi-ri-dsw-cxf:1.6.0.SNAPSHOT]
        at 
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore.exportService(RemoteServiceAdminCore.java:140)[161:cxf-dosgi-ri-dsw-cxf:1.6.0.SNAPSHOT]
        at 
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:59)[161:cxf-dosgi-ri-dsw-cxf:1.6.0.SNAPSHOT]
        at 
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance$1.run(RemoteServiceAdminInstance.java:57)[161:cxf-dosgi-ri-dsw-cxf:1.6.0.SNAPSHOT]
        at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_25]
        at 
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:57)[161:cxf-dosgi-ri-dsw-cxf:1.6.0.SNAPSHOT]
        at 
org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminInstance.exportService(RemoteServiceAdminInstance.java:41)[161:cxf-dosgi-ri-dsw-cxf:1.6.0.SNAPSHOT]
        at 
org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.exportServiceUsingRemoteServiceAdmin(TopologyManagerExport.java:185)[160:cxf-dosgi-ri-topology-manager:1.6.0.SNAPSHOT]
        at 
org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport.doExportService(TopologyManagerExport.java:168)[160:cxf-dosgi-ri-topology-manager:1.6.0.SNAPSHOT]
        at 
org.apache.cxf.dosgi.topologymanager.exporter.TopologyManagerExport$3.run(TopologyManagerExport.java:143)[160:cxf-dosgi-ri-topology-manager:1.6.0.SNAPSHOT]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_25]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)[:1.7.0_25]
        at java.lang.Thread.run(Thread.java:724)[:1.7.0_25]

                
> Possible memory leak in ServiceImpl
> -----------------------------------
>
>                 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