Hi,

On 01.03.11 11:15, "Bigard Olivier" <[email protected]> wrote:

>Hi all,
>
>We faced a deadlock issue with iPojo 1.6.4 (and also reproduced with
>iPojo 1.8.0).
>Here are the details of the context:
>
>
>1)      We have a first iPojo Component that we will call "PDP".
>This Component is declared with the 3 iPojo annotations "Component",
>"Instantiate" and "Provides".
>
>2)      We have a second iPojo Component that we will call "PEP".
>This Component is declared with the 3 iPojo annotations "Component",
>"Instantiate" and "Provides".
>This Component requires the "PDP" Component with a "@Requires(policy =
>"dynamic-priority")" annotation.
>In a public method of the "PEP" Component we try to access to a method of
>the "PDP" reference.


Thanks, I will try to reproduce it and check

>
>During some tests, we are facing the following deadlock problem:
>
>2011-02-28 16:38:12,379 - [Thread Monitor] WARN
>(WatcherActivator.deadlockDetected:70) - Thread Deadlock detected...
>2011-02-28 16:38:12,379 - [Thread Monitor] WARN
>(WatcherActivator.deadlockDetected:71) - Deadlocked Thread:
>"AsyncRequest-1" Id=87 BLOCKED on
>org.apache.felix.ipojo.handlers.providedservice.ProvidedService@1664cb5
>owned by "Thread-7" Id=29
>                at
>org.apache.felix.ipojo.handlers.providedservice.ProvidedService.update(Pro
>videdService.java:446)
>                -  blocked on
>org.apache.felix.ipojo.handlers.providedservice.ProvidedService@1664cb5
>                at
>org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.__o
>nSet(ProvidedServiceHandler.java:432)
>                at
>org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.onS
>et(ProvidedServiceHandler.java)
>                at
>org.apache.felix.ipojo.InstanceManager.onSet(InstanceManager.java:1102)
>                at
>com.axway.drw.core.defimpl.policy.DefaultPolicyDecisionPoint.__setranking(
>DefaultPolicyDecisionPoint.java)
>                at
>com.axway.drw.core.defimpl.policy.DefaultPolicyDecisionPoint.<init>(Defaul
>tPolicyDecisionPoint.java:32)
>                at
>sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>                at
>sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAcc
>essorImpl.java:39)
>                
>sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstr
>uctorAccessorImpl.java:27)
>                
>java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>                
>org.apache.felix.ipojo.InstanceManager.createObject(InstanceManager.java:6
>01)
>                
>org.apache.felix.ipojo.InstanceManager.getPojoObject(InstanceManager.java:
>777)
>                
>org.apache.felix.ipojo.handlers.providedservice.ProvidedService$SingletonS
>trategy.getService(ProvidedService.java:691)
>                
>org.apache.felix.ipojo.handlers.providedservice.ProvidedService.getService
>(ProvidedService.java:306)
>                
>org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(Ser
>viceRegistrationImpl.java:307)
>                
>org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegis
>trationImpl.java:221)
>                
>org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java
>:295)
>                
>org.apache.felix.framework.Felix.getService(Felix.java:3007)
>                
>org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.
>java:329)
>                
>org.apache.felix.ipojo.IPojoContext.getService(IPojoContext.java:260)
>                
>org.apache.felix.ipojo.util.Tracker.getService(Tracker.java:441)
>                
>org.apache.felix.ipojo.util.DependencyModel.getService(DependencyModel.jav
>a:911)
>                
>org.apache.felix.ipojo.handlers.dependency.Dependency.createServiceObject(
>Dependency.java:631)
>                
>org.apache.felix.ipojo.handlers.dependency.Dependency.onGet(Dependency.jav
>a:602)
>                
>org.apache.felix.ipojo.InstanceManager.onGet(InstanceManager.java:945)
>                
>com.axway.darwin.server.core.rest.impl.rest.policy.RestPolicyEnforcementPo
>int.__getpdp(RestPolicyEnforcementPoint.java)
>                
>com.axway.darwin.server.core.rest.impl.rest.policy.RestPolicyEnforcementPo
>int.__preFilter(RestPolicyEnforcementPoint.java:170)
>                
>com.axway.darwin.server.core.rest.impl.rest.policy.RestPolicyEnforcementPo
>int.preFilter(RestPolicyEnforcementPoint.java)
>                
>com.axway.darwin.server.core.rest.impl.rest.InterceptorFilterManager.preFi
>lter(InterceptorFilterManager.java:86)
>                
>com.axway.darwin.server.core.rest.impl.rest.InterceptorFilterManager.acces
>s$200(InterceptorFilterManager.java:32)
>                
>com.axway.darwin.server.core.rest.impl.rest.InterceptorFilterManager$Resou
>rceFilterAdapter.filter(InterceptorFilterManager.java:132)
>                
>com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.
>java:270)
>                
>com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPat
>hRule.java:136)
>                
>com.sun.jersey.server.impl.uri.rules.ResourceObjectRule.accept(ResourceObj
>ectRule.java:84)
>                
>com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPat
>hRule.java:136)
>                
>com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootRe
>sourceClassesRule.java:74)
>                
>com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(W
>ebApplicationImpl.java:1347)
>                
>com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(W
>ebApplicationImpl.java:1279)
>                
>com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(We
>bApplicationImpl.java:1229)
>                
>com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(We
>bApplicationImpl.java:1219)
>                
>com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer._service(Gri
>zzlyContainer.java:180)
>                
>com.sun.jersey.server.impl.container.grizzly.GrizzlyContainer.service(Griz
>zlyContainer.java:145)
>                
>com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
>                
>com.axway.darwin.server.core.rest.impl.rest.JerseyAdapter.service(JerseyAd
>apter.java:124)
>                
>com.axway.darwin.server.core.http.impl.auth.GrizzlyAuthenticationFilter.se
>rveProtectedAdapter(GrizzlyAuthenticationFilter.java:374)
>                
>com.axway.darwin.server.core.http.impl.auth.GrizzlyAuthenticationFilter.se
>rvice(GrizzlyAuthenticationFilter.java:96)
>                
>com.axway.darwin.server.core.http.async.AsyncRequest.run(AsyncRequest.java
>:63)
>                
>java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.
>java:886)
>                
>java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java
>:908)
>                java.lang.Thread.run(Thread.java:662)
>
>2011-02-28 16:38:12,379 - [Thread Monitor] WARN
>(WatcherActivator.deadlockDetected:70) - Thread Deadlock detected...
>2011-02-28 16:38:12,379 - [Thread Monitor] WARN
>(WatcherActivator.deadlockDetected:71) - Deadlocked Thread:
>"Thread-7" Id=29 BLOCKED on
>org.apache.felix.ipojo.util.Tracker$Tracked@a28708 owned by
>"AsyncRequest-1" Id=87
>                at
>org.apache.felix.ipojo.util.Tracker$Tracked.track(Tracker.java:666)
>                -  blocked on
>org.apache.felix.ipojo.util.Tracker$Tracked@a28708
>                at
>org.apache.felix.ipojo.util.Tracker$Tracked.serviceChanged(Tracker.java:64
>7)
>                at
>org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallb
>ack(EventDispatcher.java:864)
>                at
>org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(Event
>Dispatcher.java:732)
>                at
>org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDisp
>atcher.java:662)
>                at
>org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3726)
>                at
>org.apache.felix.framework.Felix.access$000(Felix.java:80)
>                at
>org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:717)
>                
>org.apache.felix.framework.ServiceRegistry.servicePropertiesModified(Servi
>ceRegistry.java:478)
>                
>org.apache.felix.framework.ServiceRegistrationImpl.setProperties(ServiceRe
>gistrationImpl.java:116)
>                
>org.apache.felix.ipojo.handlers.providedservice.ProvidedService.registerSe
>rvice(ProvidedService.java:348)
>                
>org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.__s
>tateChanged(ProvidedServiceHandler.java:494)
>                
>org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.sta
>teChanged(ProvidedServiceHandler.java)
>                
>org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:441)
>                
>org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:322)
>                
>org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.ja
>va:155)
>                
>org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.j
>ava:301)
>                
>org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.j
>ava:238)
>                
>org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCrea
>tor.java:343)
>                
>org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89
>)
>                org.apache.felix.ipojo.Extender.parse(Extender.java:269)
>                
>org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
>                
>org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
>                
>org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
>                java.lang.Thread.run(Thread.java:662)
>
>It seems that the 2 threads are trying to modify the same
>"ProvidedService" instance: the first one to update the value of the
>"ServiceRanking" property and the second one to change its state.
>
>One very important information: we tried to change the way to instantiate
>the second Component ("PDP") by using the XML instead of the annotation
>and the deadlock disappeared!

This just change the order of the declaration that make the difference.
Indeed, both XML and annotations are mixed in the bundle manifest.

Regards,

Clement

>
>Thank you for your help
>Olivier



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to