Return-Path: X-Original-To: apmail-felix-dev-archive@www.apache.org Delivered-To: apmail-felix-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A40EC94DA for ; Tue, 12 Jun 2012 13:01:46 +0000 (UTC) Received: (qmail 34112 invoked by uid 500); 12 Jun 2012 13:01:44 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 33856 invoked by uid 500); 12 Jun 2012 13:01:43 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 33634 invoked by uid 99); 12 Jun 2012 13:01:43 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jun 2012 13:01:43 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 428AC1402B5 for ; Tue, 12 Jun 2012 13:01:43 +0000 (UTC) Date: Tue, 12 Jun 2012 13:01:42 +0000 (UTC) From: "Julien MASSENET (JIRA)" To: dev@felix.apache.org Message-ID: <1043530745.7425.1339506103276.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Created] (FELIX-3545) Memory leak when unregistering a component used by an aggregate dependency with an unbind callback MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 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