[
https://issues.apache.org/jira/browse/FELIX-3910?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13789080#comment-13789080
]
Pierre De Rop commented on FELIX-3910:
--------------------------------------
Before submitting a patch, I need a better integration test than the RaceTest I
committed in test/ submodule. I also need the latest pax exam, as well as
latest felix framework.
So, as discussed with Marcel privately, I committed in revision 1530206., a new
"test2" subproject, based on pax exam 3.0.0 and latest Felix framework.
In that new test2 project, I committed an "AspectRaceTest" which reproduces
some race conditions when aspect-aware services are concurrently
registered/unregistered.
I also started to migrate the old api test
"test/src/test/java/org/apache/felix/dm/test/AspectBaseTest.java", and moved it
to
test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/AspectBaseTest.java
The work is in progress, and the intent is to progressively migrate all our
existing tests from test/* into test2/*. And once all is migrated, we'll
finally remove old "test" module and rename new "test2" module into "test".
To run the tests, the "mvn clean install" command has to be executed (because
tests are run in the integration phase, after the test phase. I need this in
order to be able to generate some annotated components before executing tests.
Basically, migrating an old api test seems simple: the test has to extend
TestBase, which already has a @Configuration annotation. If one maven
dependency is missing, just add it to the TestBase class.
Notice that with the new pax exam 3.0.0, all testXXX methods must not take the
BundleContext in parameter (but the super class has a "context" BundleContext
class attribute, which can be reused by all existing tests).
The test2 module is organized like this:
* src/main/java/org/apache/felix/dependencymanager/test2/components/
This package contains some components used by integration tests. Most of the
components from this package are meant to be used by only annotations tests,
except the "Ensure" helper, which is used by all integration tests.
* src/test/java/org/apache/felix/dependencymanager/test2/integration/*
this package contains all integration tests
* src/test/java/org/apache/felix/dependencymanager/test2/integration/api/*
this package contains all API integration tests. For now, I have migrated the
old test/.../AspectBaseTest.java into
test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/api/AspectBaseTest.java
There is also the new AspectRaceTest in the api package.
*
src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations/*
this package contains all Annotations integration tests. For now, I migrated
the old test/.../SimpleAnnotationsTest.java into
test2/src/test/java/org/apache/felix/dependencymanager/test2/integration/annotations//SimpleAnnotationsTest.java
I will now cleanup the patch and will submit it to this issue a bit later.
/Pierre
> 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
> Attachments: FELIX-3910-patch, FELIX-3910.patch.2,
> FELIX-3910.patch.3, FELIX-3910.patch.4
>
>
> 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 was sent by Atlassian JIRA
(v6.1#6144)