Pierre De Rop created FELIX-3910: ------------------------------------ Summary: Race conditions in DependencyManager Key: FELIX-3910 URL: https://issues.apache.org/jira/browse/FELIX-3910 Project: Felix Issue Type: Bug Components: Dependency Manager Affects Versions: dependencymanager-3.0.0 Environment: jdk1.6, jdk1.7, linux fc16 Reporter: Pierre De Rop
In a multi threaded context, where dependencies are injected concurrently from different threads, we came across some exceptions which seem to take place from dependencymanager. I have tried to reproduce the problems using a paxexam test which I will commit. Not all exceptions are reproduced by the test case, but I think that the testcase really reproduces a problem. I also have a candidate patch, which I will submit to this jira issue. Here are the exceptions we have seen: first stacktrace seen: =============== ERROR: Bundle test.dm [21] EventDispatcher: Error during dispatch. (java.lang.NullPointerException) java.lang.NullPointerException at org.apache.felix.dm.impl.dependencies.ServiceDependencyImpl.addedService(ServiceDependencyImpl.java:481) at org.apache.felix.dm.tracker.ServiceTracker$Tracked.customizerAdded(ServiceTracker.java:1325) at org.apache.felix.dm.tracker.AbstractTracked.trackAdding(AbstractTracked.java:290) at org.apache.felix.dm.tracker.AbstractTracked.track(AbstractTracked.java:236) at org.apache.felix.dm.tracker.ServiceTracker$Tracked.serviceChangedHideAspects(ServiceTracker.java:1206) at org.apache.felix.dm.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1101) at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932) at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793) at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543) at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260) at org.apache.felix.framework.Felix.registerService(Felix.java:3275) at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346) at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:320) at test.dm.race.RaceTest$RegistrationHelper$1.run(RaceTest.java:104) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) second exceptions: ============== ERROR: EventDispatcher: Error during dispatch. (java.lang.NullPointerException) java.lang.NullPointerException at org.apache.felix.dm.impl.ComponentImpl.invokeCallbackMethod(ComponentImpl.java:686) at org.apache.felix.dm.impl.dependencies.ServiceDependencyImpl.invoke(ServiceDependencyImpl.java:704) at org.apache.felix.dm.impl.dependencies.ServiceDependencyImpl.invokeRemoved(ServiceDependencyImpl.java:666) at org.apache.felix.dm.impl.dependencies.ServiceDependencyImpl.removedService(ServiceDependencyImpl.java:520) at org.apache.felix.dm.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1351) at org.apache.felix.dm.tracker.AbstractTracked.untrack(AbstractTracked.java:359) at org.apache.felix.dm.tracker.ServiceTracker$Tracked.serviceChangedHideAspects(ServiceTracker.java:1285) at org.apache.felix.dm.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:1101) at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:878) at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:732) at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662) at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3587) at org.apache.felix.framework.Felix.access$000(Felix.java:40) at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:625) at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:117) at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:128) at org.apache.felix.dm.test.RaceTest$AFactory$2.run(RaceTest.java:151) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) -- 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