You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Rajini Sivaram (JIRA)" <ji...@apache.org> on 2008/02/13 09:40:07 UTC

[jira] Created: (FELIX-489) Intermittent deadlock while using declarative services in Tuscany

Intermittent deadlock while using declarative services in Tuscany   
--------------------------------------------------------------------

                 Key: FELIX-489
                 URL: https://issues.apache.org/jira/browse/FELIX-489
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services
    Affects Versions: 1.0.0
            Reporter: Rajini Sivaram


One of my tests using declarative services hangs intermittently. The stack trace from a debugger shows two threads waiting for locks owned by the other. I am using Felix framework 1.0.3 and SCR 1.0.0. The call from the main thread to getService is triggered by Tuscany - I am not sure if there are times when it shouldn't call bundleContext.getService. But the order of locking in the two threads are different leading to the deadlock - is it something that could be fixed? The main thread owns the ServiceRegistry lock and is waiting for the lock on ServiceFactoryComponentManager, while the configuration updater owns the ServiceFactoryComponentManager lock and is waiting for the ServiceRegistry lock.
 
 
Thread [main] (Suspended) 
   ServiceFactoryComponentManager.getService(Bundle, ServiceRegistration) line: 111 
   ServiceRegistrationImpl.getFactoryUnchecked(Bundle) line: 245 
   ServiceRegistrationImpl.getService(Bundle) line: 179 
   ServiceRegistry.getService(Bundle, ServiceReference) line: 238 
   Felix.getService(Bundle, ServiceReference) line: 2835 
   BundleContextImpl.getService(ServiceReference) line: 417 
   .............. (Tuscany)
 
Thread [Configuration Updater] (Suspended) 
   ServiceRegistry.unregisterService(Bundle, ServiceRegistration) line: 78 
   ServiceRegistrationImpl.unregister() line: 99 
   ServiceFactoryComponentManager(AbstractComponentManager).unregisterComponentService() line: 610 
   ServiceFactoryComponentManager(AbstractComponentManager).deactivateInternal() line: 464 
   ServiceFactoryComponentManager(AbstractComponentManager).reactivate() line: 142 
   ServiceFactoryComponentManager(ImmediateComponentManager).reconfigure(Dictionary) line: 399 
   ImmediateComponentManager$1.updated(Dictionary) line: 90 
   ConfigurationManager$ManagedServiceUpdate.run() line: 863 
   UpdateThread.run() line: 89 
 
 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-489) Intermittent deadlock while using declarative services in Tuscany

Posted by "Karl Pauls (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12568473#action_12568473 ] 

Karl Pauls commented on FELIX-489:
----------------------------------

This is due to the fact that we hold the ServiceRegistry lock while calling out to bundle provided service factories. This is an oversight and should be fixed. I'll look into it.

> Intermittent deadlock while using declarative services in Tuscany   
> --------------------------------------------------------------------
>
>                 Key: FELIX-489
>                 URL: https://issues.apache.org/jira/browse/FELIX-489
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services
>    Affects Versions: 1.0.0
>            Reporter: Rajini Sivaram
>            Assignee: Karl Pauls
>
> One of my tests using declarative services hangs intermittently. The stack trace from a debugger shows two threads waiting for locks owned by the other. I am using Felix framework 1.0.3 and SCR 1.0.0. The call from the main thread to getService is triggered by Tuscany - I am not sure if there are times when it shouldn't call bundleContext.getService. But the order of locking in the two threads are different leading to the deadlock - is it something that could be fixed? The main thread owns the ServiceRegistry lock and is waiting for the lock on ServiceFactoryComponentManager, while the configuration updater owns the ServiceFactoryComponentManager lock and is waiting for the ServiceRegistry lock.
>  
>  
> Thread [main] (Suspended) 
>    ServiceFactoryComponentManager.getService(Bundle, ServiceRegistration) line: 111 
>    ServiceRegistrationImpl.getFactoryUnchecked(Bundle) line: 245 
>    ServiceRegistrationImpl.getService(Bundle) line: 179 
>    ServiceRegistry.getService(Bundle, ServiceReference) line: 238 
>    Felix.getService(Bundle, ServiceReference) line: 2835 
>    BundleContextImpl.getService(ServiceReference) line: 417 
>    .............. (Tuscany)
>  
> Thread [Configuration Updater] (Suspended) 
>    ServiceRegistry.unregisterService(Bundle, ServiceRegistration) line: 78 
>    ServiceRegistrationImpl.unregister() line: 99 
>    ServiceFactoryComponentManager(AbstractComponentManager).unregisterComponentService() line: 610 
>    ServiceFactoryComponentManager(AbstractComponentManager).deactivateInternal() line: 464 
>    ServiceFactoryComponentManager(AbstractComponentManager).reactivate() line: 142 
>    ServiceFactoryComponentManager(ImmediateComponentManager).reconfigure(Dictionary) line: 399 
>    ImmediateComponentManager$1.updated(Dictionary) line: 90 
>    ConfigurationManager$ManagedServiceUpdate.run() line: 863 
>    UpdateThread.run() line: 89 
>  
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (FELIX-489) Intermittent deadlock while using declarative services in Tuscany

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/FELIX-489?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12569440#action_12569440 ] 

Richard S. Hall commented on FELIX-489:
---------------------------------------

If it was not clear, I committed the patch to trunk and deploy snapshots.

> Intermittent deadlock while using declarative services in Tuscany   
> --------------------------------------------------------------------
>
>                 Key: FELIX-489
>                 URL: https://issues.apache.org/jira/browse/FELIX-489
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services
>    Affects Versions: 1.0.0
>            Reporter: Rajini Sivaram
>            Assignee: Karl Pauls
>
> One of my tests using declarative services hangs intermittently. The stack trace from a debugger shows two threads waiting for locks owned by the other. I am using Felix framework 1.0.3 and SCR 1.0.0. The call from the main thread to getService is triggered by Tuscany - I am not sure if there are times when it shouldn't call bundleContext.getService. But the order of locking in the two threads are different leading to the deadlock - is it something that could be fixed? The main thread owns the ServiceRegistry lock and is waiting for the lock on ServiceFactoryComponentManager, while the configuration updater owns the ServiceFactoryComponentManager lock and is waiting for the ServiceRegistry lock.
>  
>  
> Thread [main] (Suspended) 
>    ServiceFactoryComponentManager.getService(Bundle, ServiceRegistration) line: 111 
>    ServiceRegistrationImpl.getFactoryUnchecked(Bundle) line: 245 
>    ServiceRegistrationImpl.getService(Bundle) line: 179 
>    ServiceRegistry.getService(Bundle, ServiceReference) line: 238 
>    Felix.getService(Bundle, ServiceReference) line: 2835 
>    BundleContextImpl.getService(ServiceReference) line: 417 
>    .............. (Tuscany)
>  
> Thread [Configuration Updater] (Suspended) 
>    ServiceRegistry.unregisterService(Bundle, ServiceRegistration) line: 78 
>    ServiceRegistrationImpl.unregister() line: 99 
>    ServiceFactoryComponentManager(AbstractComponentManager).unregisterComponentService() line: 610 
>    ServiceFactoryComponentManager(AbstractComponentManager).deactivateInternal() line: 464 
>    ServiceFactoryComponentManager(AbstractComponentManager).reactivate() line: 142 
>    ServiceFactoryComponentManager(ImmediateComponentManager).reconfigure(Dictionary) line: 399 
>    ImmediateComponentManager$1.updated(Dictionary) line: 90 
>    ConfigurationManager$ManagedServiceUpdate.run() line: 863 
>    UpdateThread.run() line: 89 
>  
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (FELIX-489) Intermittent deadlock while using declarative services in Tuscany

Posted by "Richard S. Hall (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-489?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Richard S. Hall resolved FELIX-489.
-----------------------------------

    Resolution: Fixed

After much discussion with Karl, we have created a patch that makes locking in the service registry more fine-grained to avoid holding locks when performing callbacks to the service factory. Rajini, please test and see if this resolves your issues. If so, please close the bug.

> Intermittent deadlock while using declarative services in Tuscany   
> --------------------------------------------------------------------
>
>                 Key: FELIX-489
>                 URL: https://issues.apache.org/jira/browse/FELIX-489
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services
>    Affects Versions: 1.0.0
>            Reporter: Rajini Sivaram
>            Assignee: Karl Pauls
>
> One of my tests using declarative services hangs intermittently. The stack trace from a debugger shows two threads waiting for locks owned by the other. I am using Felix framework 1.0.3 and SCR 1.0.0. The call from the main thread to getService is triggered by Tuscany - I am not sure if there are times when it shouldn't call bundleContext.getService. But the order of locking in the two threads are different leading to the deadlock - is it something that could be fixed? The main thread owns the ServiceRegistry lock and is waiting for the lock on ServiceFactoryComponentManager, while the configuration updater owns the ServiceFactoryComponentManager lock and is waiting for the ServiceRegistry lock.
>  
>  
> Thread [main] (Suspended) 
>    ServiceFactoryComponentManager.getService(Bundle, ServiceRegistration) line: 111 
>    ServiceRegistrationImpl.getFactoryUnchecked(Bundle) line: 245 
>    ServiceRegistrationImpl.getService(Bundle) line: 179 
>    ServiceRegistry.getService(Bundle, ServiceReference) line: 238 
>    Felix.getService(Bundle, ServiceReference) line: 2835 
>    BundleContextImpl.getService(ServiceReference) line: 417 
>    .............. (Tuscany)
>  
> Thread [Configuration Updater] (Suspended) 
>    ServiceRegistry.unregisterService(Bundle, ServiceRegistration) line: 78 
>    ServiceRegistrationImpl.unregister() line: 99 
>    ServiceFactoryComponentManager(AbstractComponentManager).unregisterComponentService() line: 610 
>    ServiceFactoryComponentManager(AbstractComponentManager).deactivateInternal() line: 464 
>    ServiceFactoryComponentManager(AbstractComponentManager).reactivate() line: 142 
>    ServiceFactoryComponentManager(ImmediateComponentManager).reconfigure(Dictionary) line: 399 
>    ImmediateComponentManager$1.updated(Dictionary) line: 90 
>    ConfigurationManager$ManagedServiceUpdate.run() line: 863 
>    UpdateThread.run() line: 89 
>  
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (FELIX-489) Intermittent deadlock while using declarative services in Tuscany

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-489?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger updated FELIX-489:
------------------------------------

    Fix Version/s: scr-1.0.0

> Intermittent deadlock while using declarative services in Tuscany   
> --------------------------------------------------------------------
>
>                 Key: FELIX-489
>                 URL: https://issues.apache.org/jira/browse/FELIX-489
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: felix-1.0.0
>            Reporter: Rajini Sivaram
>            Assignee: Karl Pauls
>             Fix For: scr-1.0.0
>
>
> One of my tests using declarative services hangs intermittently. The stack trace from a debugger shows two threads waiting for locks owned by the other. I am using Felix framework 1.0.3 and SCR 1.0.0. The call from the main thread to getService is triggered by Tuscany - I am not sure if there are times when it shouldn't call bundleContext.getService. But the order of locking in the two threads are different leading to the deadlock - is it something that could be fixed? The main thread owns the ServiceRegistry lock and is waiting for the lock on ServiceFactoryComponentManager, while the configuration updater owns the ServiceFactoryComponentManager lock and is waiting for the ServiceRegistry lock.
>  
>  
> Thread [main] (Suspended) 
>    ServiceFactoryComponentManager.getService(Bundle, ServiceRegistration) line: 111 
>    ServiceRegistrationImpl.getFactoryUnchecked(Bundle) line: 245 
>    ServiceRegistrationImpl.getService(Bundle) line: 179 
>    ServiceRegistry.getService(Bundle, ServiceReference) line: 238 
>    Felix.getService(Bundle, ServiceReference) line: 2835 
>    BundleContextImpl.getService(ServiceReference) line: 417 
>    .............. (Tuscany)
>  
> Thread [Configuration Updater] (Suspended) 
>    ServiceRegistry.unregisterService(Bundle, ServiceRegistration) line: 78 
>    ServiceRegistrationImpl.unregister() line: 99 
>    ServiceFactoryComponentManager(AbstractComponentManager).unregisterComponentService() line: 610 
>    ServiceFactoryComponentManager(AbstractComponentManager).deactivateInternal() line: 464 
>    ServiceFactoryComponentManager(AbstractComponentManager).reactivate() line: 142 
>    ServiceFactoryComponentManager(ImmediateComponentManager).reconfigure(Dictionary) line: 399 
>    ImmediateComponentManager$1.updated(Dictionary) line: 90 
>    ConfigurationManager$ManagedServiceUpdate.run() line: 863 
>    UpdateThread.run() line: 89 
>  
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (FELIX-489) Intermittent deadlock while using declarative services in Tuscany

Posted by "Karl Pauls (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-489?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Karl Pauls reassigned FELIX-489:
--------------------------------

    Assignee: Karl Pauls

> Intermittent deadlock while using declarative services in Tuscany   
> --------------------------------------------------------------------
>
>                 Key: FELIX-489
>                 URL: https://issues.apache.org/jira/browse/FELIX-489
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services
>    Affects Versions: 1.0.0
>            Reporter: Rajini Sivaram
>            Assignee: Karl Pauls
>
> One of my tests using declarative services hangs intermittently. The stack trace from a debugger shows two threads waiting for locks owned by the other. I am using Felix framework 1.0.3 and SCR 1.0.0. The call from the main thread to getService is triggered by Tuscany - I am not sure if there are times when it shouldn't call bundleContext.getService. But the order of locking in the two threads are different leading to the deadlock - is it something that could be fixed? The main thread owns the ServiceRegistry lock and is waiting for the lock on ServiceFactoryComponentManager, while the configuration updater owns the ServiceFactoryComponentManager lock and is waiting for the ServiceRegistry lock.
>  
>  
> Thread [main] (Suspended) 
>    ServiceFactoryComponentManager.getService(Bundle, ServiceRegistration) line: 111 
>    ServiceRegistrationImpl.getFactoryUnchecked(Bundle) line: 245 
>    ServiceRegistrationImpl.getService(Bundle) line: 179 
>    ServiceRegistry.getService(Bundle, ServiceReference) line: 238 
>    Felix.getService(Bundle, ServiceReference) line: 2835 
>    BundleContextImpl.getService(ServiceReference) line: 417 
>    .............. (Tuscany)
>  
> Thread [Configuration Updater] (Suspended) 
>    ServiceRegistry.unregisterService(Bundle, ServiceRegistration) line: 78 
>    ServiceRegistrationImpl.unregister() line: 99 
>    ServiceFactoryComponentManager(AbstractComponentManager).unregisterComponentService() line: 610 
>    ServiceFactoryComponentManager(AbstractComponentManager).deactivateInternal() line: 464 
>    ServiceFactoryComponentManager(AbstractComponentManager).reactivate() line: 142 
>    ServiceFactoryComponentManager(ImmediateComponentManager).reconfigure(Dictionary) line: 399 
>    ImmediateComponentManager$1.updated(Dictionary) line: 90 
>    ConfigurationManager$ManagedServiceUpdate.run() line: 863 
>    UpdateThread.run() line: 89 
>  
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (FELIX-489) Intermittent deadlock while using declarative services in Tuscany

Posted by "Rajini Sivaram (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/FELIX-489?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajini Sivaram closed FELIX-489.
--------------------------------


Thank you, Karl and Richard. The tests run fine with the latest snapshot.

> Intermittent deadlock while using declarative services in Tuscany   
> --------------------------------------------------------------------
>
>                 Key: FELIX-489
>                 URL: https://issues.apache.org/jira/browse/FELIX-489
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services
>    Affects Versions: 1.0.0
>            Reporter: Rajini Sivaram
>            Assignee: Karl Pauls
>
> One of my tests using declarative services hangs intermittently. The stack trace from a debugger shows two threads waiting for locks owned by the other. I am using Felix framework 1.0.3 and SCR 1.0.0. The call from the main thread to getService is triggered by Tuscany - I am not sure if there are times when it shouldn't call bundleContext.getService. But the order of locking in the two threads are different leading to the deadlock - is it something that could be fixed? The main thread owns the ServiceRegistry lock and is waiting for the lock on ServiceFactoryComponentManager, while the configuration updater owns the ServiceFactoryComponentManager lock and is waiting for the ServiceRegistry lock.
>  
>  
> Thread [main] (Suspended) 
>    ServiceFactoryComponentManager.getService(Bundle, ServiceRegistration) line: 111 
>    ServiceRegistrationImpl.getFactoryUnchecked(Bundle) line: 245 
>    ServiceRegistrationImpl.getService(Bundle) line: 179 
>    ServiceRegistry.getService(Bundle, ServiceReference) line: 238 
>    Felix.getService(Bundle, ServiceReference) line: 2835 
>    BundleContextImpl.getService(ServiceReference) line: 417 
>    .............. (Tuscany)
>  
> Thread [Configuration Updater] (Suspended) 
>    ServiceRegistry.unregisterService(Bundle, ServiceRegistration) line: 78 
>    ServiceRegistrationImpl.unregister() line: 99 
>    ServiceFactoryComponentManager(AbstractComponentManager).unregisterComponentService() line: 610 
>    ServiceFactoryComponentManager(AbstractComponentManager).deactivateInternal() line: 464 
>    ServiceFactoryComponentManager(AbstractComponentManager).reactivate() line: 142 
>    ServiceFactoryComponentManager(ImmediateComponentManager).reconfigure(Dictionary) line: 399 
>    ImmediateComponentManager$1.updated(Dictionary) line: 90 
>    ConfigurationManager$ManagedServiceUpdate.run() line: 863 
>    UpdateThread.run() line: 89 
>  
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.