You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Clement Escoffier (JIRA)" <ji...@apache.org> on 2013/02/04 13:36:13 UTC

[jira] [Closed] (FELIX-3545) Memory leak when unregistering a component used by an aggregate dependency with an unbind callback

     [ https://issues.apache.org/jira/browse/FELIX-3545?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clement Escoffier closed FELIX-3545.
------------------------------------

    
> Memory leak when unregistering a component used by an aggregate dependency with an unbind callback
> --------------------------------------------------------------------------------------------------
>
>                 Key: FELIX-3545
>                 URL: https://issues.apache.org/jira/browse/FELIX-3545
>             Project: Felix
>          Issue Type: Bug
>          Components: iPOJO
>    Affects Versions: ipojo-core-1.8.2
>         Environment: Felix distribution 4.0.2, iPojo 1.8.2, Oracle JVM 1.6.0_u31, W7x64
>            Reporter: Julien MASSENET
>            Assignee: Clement Escoffier
>             Fix For: ipojo-core-1.8.4
>
>         Attachments: issue_showcase.zip
>
>
> When using aggregate dependencies in an iPojo instance, any injected dependency instance that is unbound when using an unbind callback will leak in memory.
> How to reproduce using the attached sample project:
> - Build the provided bundles using maven (mvn clean install)
> - Start the OSGi environment, install and start the two bundle (consumer and provider)
> > The consumer bundle prints: 'Binding a new service; it says 'Bonjour !''
> - Uninstall the provider bundle
> > The consumer bundle prints: 'Unbinding a service; it says 'Au revoir !''
> - Take a heap dump using you favorite tool (VisualVM snapshot is provided)
> - Search for instances of provider.french.impl.FrenchGreet
>   
> Expected result:
> - No instances can be found
>   
> Actual result:
> - One instance is found
> Using svn revision 1349288 as the reference, here is my understanding of the issue:
>   
> The problem lies in the org.apache.felix.ipojo.util.DependencyModel.manageDeparture(ServiceReference, Object) method.
>   
> The service instance is removed from the m_serviceObjects map as the first step into the method, which is the expected behavior. Later, the onServiceDeparture method is called, which finally invokes the org.apache.felix.ipojo.handlers.dependency.Dependency.invokeCallback(DependencyCallback, ServiceReference, Object) method.
>   
> In this method, a call to org.apache.felix.ipojo.util.DependencyModel.getService(ServiceReference) is made, which puts back the instance in the m_serviceObjects map. This reference can never be cleared (unless the provider also goes away, in which case all instances are released), thus resulting in a leak.

--
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