felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julien MASSENET (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FELIX-3545) Memory leak when unregistering a component used by an aggregate dependency with an unbind callback
Date Tue, 12 Jun 2012 13:01:42 GMT
Julien MASSENET created FELIX-3545:
--------------------------------------

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


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