felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Jencks (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (FELIX-3862) [DS] Deadlock when service is removed during activation
Date Fri, 25 Jan 2013 08:07:12 GMT

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

David Jencks resolved FELIX-3862.
---------------------------------

       Resolution: Fixed
    Fix Version/s: scr-1.6.4

fixed by rev 1437107 (logging), 1437108 (actual fix)
                
> [DS] Deadlock when service is removed during activation
> -------------------------------------------------------
>
>                 Key: FELIX-3862
>                 URL: https://issues.apache.org/jira/browse/FELIX-3862
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-1.6.4
>            Reporter: David Jencks
>            Assignee: David Jencks
>             Fix For: scr-1.6.4
>
>
> There's a chance to fail to obtain a write lock when there's a component with at least
two references and one is unregistered during activation.  The symptoms are that one thread
says it's waiting for the tracked events to all complete and another thread can't get a lock.
> log:
> thread that is trying to activate and discovers one of the dependencies went away:
> waitForTracked trackingCount: 26 ceiling: 27 missing: [24]
> Thread trying to deal with removed dependency:
>  Component deactivation threw an exception Bundle:XXXXX(id=111) java.lang.IllegalStateException:
Could not obtain lock
> end of thread dumps:
>   LockInfo: java.util.TreeSet@d04962e LockOwnerId: -1 LockOwnerName: null
>   java.lang.Object.wait(Native Method)
>   java.lang.Object.wait(Object.java:167)
>   org.apache.felix.scr.impl.manager.AbstractComponentManager.waitForTracked(AbstractComponentManager.java:251)
>   org.apache.felix.scr.impl.manager.DependencyManager.close(DependencyManager.java:1366)
>   org.apache.felix.scr.impl.manager.ImmediateComponentManager.createImplementationObject(ImmediateComponentManager.java:281)
>   org.apache.felix.scr.impl.manager.ImmediateComponentManager.createComponent(ImmediateComponentManager.java:121)
>   org.apache.felix.scr.impl.manager.AbstractComponentManager$Unsatisfied.activate(AbstractComponentManager.java:1527)
>   org.apache.felix.scr.impl.manager.AbstractComponentManager.activateInternal(AbstractComponentManager.java:619)
>   org.apache.felix.scr.impl.manager.DependencyManager$SingleDynamicCustomizer.addedService(DependencyManager.java:660)
>   org.apache.felix.scr.impl.manager.DependencyManager$SingleDynamicCustomizer.addedService(DependencyManager.java:614)
>   org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1472)
>   org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1396)
>   org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.trackAdding(ServiceTracker.java:1208)
>   org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.track(ServiceTracker.java:1146)
>   org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1427)
>   org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
> ------------------
> java.lang.IllegalStateException: Could not obtain lock
> 	at org.apache.felix.scr.impl.manager.AbstractComponentManager.obtainWriteLock(AbstractComponentManager.java:177)
> 	at org.apache.felix.scr.impl.manager.AbstractComponentManager$State.doDeactivate(AbstractComponentManager.java:1323)
> 	at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1608)
> 	at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:624)
> 	at org.apache.felix.scr.impl.manager.DependencyManager$SingleDynamicCustomizer.removedService(DependencyManager.java:720)
> 	at org.apache.felix.scr.impl.manager.DependencyManager$SingleDynamicCustomizer.removedService(DependencyManager.java:614)
> 	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1498)
> 	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1396)
> 	at org.apache.felix.scr.impl.manager.ServiceTracker$AbstractTracked.untrack(ServiceTracker.java:1256)
> 	at org.apache.felix.scr.impl.manager.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1435)
> 	at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:107)
> ----------
> I haven't been able to figure out how to reproduce this in an integration test but the
problem seems to be that the some of the customizer added() methods track their tracking count
after they try to activate rather than before.  Changing this seems to result in fixing the
problem.  My evidence is that before the change I got 3 failures in 100 test runs and after
the change 0.

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

Mime
View raw message