Return-Path: Delivered-To: apmail-felix-dev-archive@www.apache.org Received: (qmail 15160 invoked from network); 6 Feb 2009 18:28:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Feb 2009 18:28:24 -0000 Received: (qmail 15663 invoked by uid 500); 6 Feb 2009 18:28:23 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 15627 invoked by uid 500); 6 Feb 2009 18:28:23 -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 15616 invoked by uid 99); 6 Feb 2009 18:28:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Feb 2009 10:28:23 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Feb 2009 18:28:21 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9468B234C4A9 for ; Fri, 6 Feb 2009 10:27:59 -0800 (PST) Message-ID: <985879134.1233944879593.JavaMail.jira@brutus> Date: Fri, 6 Feb 2009 10:27:59 -0800 (PST) From: "Richard S. Hall (JIRA)" To: dev@felix.apache.org Subject: [jira] Resolved: (FELIX-911) Potential deadlock between Bundle.stop() and BundleContext.registerService() In-Reply-To: <109198680.1233310319975.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/FELIX-911?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Richard S. Hall resolved FELIX-911. ----------------------------------- Resolution: Fixed I have committed a patch that causes threads waiting for a bundle lock to evaluate the state of the bundle they are trying to lock and fail if the state changes in an incompatible way. I think this should address this bug, since a thread waiting to register a service will now fail if the bundle switches to the STOPPING state. Please close this issue if you are satisfied. > Potential deadlock between Bundle.stop() and BundleContext.registerService() > ---------------------------------------------------------------------------- > > Key: FELIX-911 > URL: https://issues.apache.org/jira/browse/FELIX-911 > Project: Felix > Issue Type: Bug > Components: Framework > Affects Versions: felix-1.0.0, felix-1.0.1, felix-1.0.3, felix-1.0.4, felix-1.2.0, felix-1.2.1 , felix-1.2.2, felix-1.4.0, felix-1.4.1, felix-1.6.0 > Reporter: Felix Meschberger > Assignee: Richard S. Hall > Fix For: felix-1.6.0 > > Attachments: FELIX-911.patch > > > When a bundle tries to register a service (in thread T1) and the framework is at the same time stopping the bundle (in thread T2), it may be that thread T2 holds the bundle's lock. T1 trying to register the service is thus blocked since it cannot get the bundle lock. > This may cause a deadlock in Felix SCR, which also works with synchronized instances: T1 may be SCR Actor thread starting a component and registering a service and thus holding a lock on the component instance. T2 may be the StartLevel service trying to stop the bundle, which causes the SCR to immediately stop the component. Since the component is locked by T1, T2 cannot acquire the lock. But since T2 already has the bundle lock, T1 cannot continue. > The problem is, that in this concrete case it is the Component's activate() method which registers the service and not the SCR ComponentManager (the latter deadlock situation has been taken care of in FELIX-384). > Looking at the code of Felix.registerService it looks like we could check for the bundle state before holding the bundle lock (and we could recheck after > the lock just to be sure, if needed) and thus prevent the deadlock situation. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.