felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matias SM <matias...@yahoo.com.ar>
Subject Re: Blocked Thread while shutting down Felix / IPojo
Date Mon, 02 Apr 2012 19:58:57 GMT
I don't know if that may be your issue but in the book "OSGi in action" 
[1] they recommend that if a bundle want to stop itself, it should do so 
in a different thread. This is to avoid possible deadlocks if as part of 
the bundle finalization there is any waiting for the calls to finish. 
You can refer to the book's source code examples [2].

HTH, Regards

[1] http://www.manning.com/hall/
[2] 
http://code.google.com/p/osgi-in-action/source/browse/trunk/chapter03/shell-example/org.foo.shell/src/org/foo/shell/StopCommand.java


On 02/04/12 14:46, Gay David (Annecy) wrote:
>
> Hi,
>
> I'm currently have a problem with Felix and or IPojo.
>
> Basically the problem is when Felix is starting up and services are 
> still registering while and in the meantime a stop Felix is request.
>
> The code to stop is simple : getBundle(0).stop();
>
> If I have a look at the thread dump on JVisualVM, I have (full thread 
> dump in attachement) :
>
> "FelixStartLevel" daemon prio=6 tid=0x0000000006d6c000 nid=0xb00 
> waiting for monitor entry [0x0000000007fbf000]
>
>    java.lang.Thread.State: BLOCKED (on object monitor)
>
>                 at 
> org.apache.felix.ipojo.IPojoFactory.removeFactoryStateListener(IPojoFactory.java:491)
>
>                 - waiting to lock <0x00000000c048c790> (a 
> org.apache.felix.ipojo.ComponentFactory)
>
>                 at 
> org.apache.felix.ipojo.InstanceCreator.removeFactory(InstanceCreator.java:187)
>
>                 at 
> org.apache.felix.ipojo.Extender.closeManagementFor(Extender.java:156)
>
>                 at 
> org.apache.felix.ipojo.Extender.bundleChanged(Extender.java:129)
>
>                 at 
> org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868)
>
>                 at 
> org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789)
>
>                 at 
> org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514)
>
>                 at 
> org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4245)
>
>                 at 
> org.apache.felix.framework.Felix.stopBundle(Felix.java:2352)
>
>                 at 
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1215)
>
>                 at 
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
>
>                 at java.lang.Thread.run(Unknown Source)
>
>    Locked ownable synchronizers:
>
>                 - None
>
> And
>
> "Thread-2" daemon prio=6 tid=0x0000000007050800 nid=0x6d8 in 
> Object.wait() [0x00000000084bd000]
>
>    java.lang.Thread.State: WAITING (on object monitor)
>
>                 at java.lang.Object.wait(Native Method)
>
>                 - waiting on <0x00000000c029d238> (a [Ljava.lang.Object;)
>
> at java.lang.Object.wait(Object.java:485)
>
>                 at 
> org.apache.felix.framework.Felix.acquireBundleLock(Felix.java:4872)
>
> - locked <0x00000000c029d238> (a [Ljava.lang.Object;)
>
>                 at 
> org.apache.felix.framework.Felix.registerService(Felix.java:3206)
>
>                 at 
> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
>
>                 at 
> org.apache.felix.ipojo.IPojoContext.registerService(IPojoContext.java:338)
>
>                 at 
> org.apache.felix.ipojo.handlers.providedservice.ProvidedService.registerService(ProvidedService.java:345)
>
>                 - locked <0x00000000eafc8ea0> (a 
> org.apache.felix.ipojo.handlers.providedservice.ProvidedService)
>
>                 at 
> org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.__stateChanged(ProvidedServiceHandler.java:494)
>
>                 at 
> org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceHandler.stateChanged(ProvidedServiceHandler.java)
>
>                 at 
> org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
>
>                 at 
> org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353)
>
>                 at 
> org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166)
>
>                 at 
> org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301)
>
>                 - locked <0x00000000c048c790> (a 
> org.apache.felix.ipojo.ComponentFactory)
>
>                 at 
> org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238)
>
>                 at 
> org.apache.felix.ipojo.Factory$$Proxy.createComponentInstance(Unknown 
> Source)
>
>                 at 
> com.axway.cmp.ume.ui.internal.ComponentDefinition.__createAndStart(ComponentDefinition.java:147)
>
>                 at 
> com.axway.cmp.ume.ui.internal.ComponentDefinition.createAndStart(ComponentDefinition.java)
>
>                 at 
> com.axway.cmp.ume.ui.internal.ComponentDefinition.__validate(ComponentDefinition.java:85)
>
>                 at 
> com.axway.cmp.ume.ui.internal.ComponentDefinition.validate(ComponentDefinition.java)
>
>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native 
> Method)
>
>                 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown 
> Source)
>
>                 at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>
>                 at java.lang.reflect.Method.invoke(Unknown Source)
>
>                 at 
> org.apache.felix.ipojo.util.Callback.call(Callback.java:237)
>
>                 at 
> org.apache.felix.ipojo.util.Callback.call(Callback.java:193)
>
>                 at 
> org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallback.call(LifecycleCallback.java:86)
>
>                 at 
> org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.__stateChanged(LifecycleCallbackHandler.java:162)
>
>                 at 
> org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java)
>
>                 at 
> org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471)
>
>                 at 
> org.apache.felix.ipojo.InstanceManager.stateChanged(InstanceManager.java:1314)
>
>                 at 
> org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:496)
>
>                 at 
> org.apache.felix.ipojo.HandlerManager.stateChanged(HandlerManager.java:239)
>
>                 at 
> org.apache.felix.ipojo.Handler.setValidity(Handler.java:174)
>
>                 at 
> org.apache.felix.ipojo.handlers.dependency.DependencyHandler.__checkContext(DependencyHandler.java:186)
>
>                 - locked <0x00000000c048e1a8> (a 
> [Lorg.apache.felix.ipojo.handlers.dependency.Dependency;)
>
>                 at 
> org.apache.felix.ipojo.handlers.dependency.DependencyHandler.checkContext(DependencyHandler.java)
>
>                 at 
> org.apache.felix.ipojo.handlers.dependency.DependencyHandler.__validate(DependencyHandler.java:149)
>
>                 at 
> org.apache.felix.ipojo.handlers.dependency.DependencyHandler.validate(DependencyHandler.java)
>
>                 at 
> org.apache.felix.ipojo.util.DependencyModel.validate(DependencyModel.java:642)
>
>                 at 
> org.apache.felix.ipojo.util.DependencyModel.computeDependencyState(DependencyModel.java:310)
>
>                 at 
> org.apache.felix.ipojo.util.DependencyModel.manageArrival(DependencyModel.java:399)
>
>                 at 
> org.apache.felix.ipojo.util.DependencyModel.addedService(DependencyModel.java:335)
>
>                 at 
> org.apache.felix.ipojo.util.Tracker$Tracked.trackAdding(Tracker.java:725)
>
>                 at 
> org.apache.felix.ipojo.util.Tracker$Tracked.track(Tracker.java:686)
>
>                 at 
> org.apache.felix.ipojo.util.Tracker$Tracked.serviceChanged(Tracker.java:647)
>
>                 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:4261)
>
>                 at 
> org.apache.felix.framework.Felix.registerService(Felix.java:3276)
>
>                 at 
> org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:346)
>
>                 at 
> org.apache.felix.ipojo.IPojoFactory.start(IPojoFactory.java:591)
>
>                 - locked <0x00000000c048c790> (a 
> org.apache.felix.ipojo.ComponentFactory)
>
>                 at 
> org.apache.felix.ipojo.Extender.createAbstractFactory(Extender.java:439)
>
>                 at 
> org.apache.felix.ipojo.Extender.parse(Extender.java:264)
>
>                 at 
> org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208)
>
>                 at 
> org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
>
>                 at 
> org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682)
>
>                 at java.lang.Thread.run(Unknown Source)
>
> While I'm still investigating what's happen, it looks like I'm having 
> the issue https://issues.apache.org/jira/browse/FELIX-3393  but I'm 
> not sure
>
> I'm using Felix 4.0.2, but I got the same problem with the latest trunk.
>
> I would like to do a simple test case to reproduce the problem on a 
> simple test case, but without success for the moment.
>
> Is it possible that the #3393 issue may be the root cause ?
>
> Maybe an iPojo issue ? (I could post a brief sample of what I do with 
> iPojo factories in ComponentDefinition class if it helps)
>
> Or maybe my code (Normally 99,99% of the time it's my fault) ;-)
>
> Thanks for your help
>
> WBR // David
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message