Uploaded image for project: 'Felix'
  1. Felix
  2. FELIX-3421

Blocked Thread while shutting down Felix during iPojo service registration

    XMLWordPrintableJSON

    Details

      Description

      Problem when Felix is starting up and iPojo services are still registering while and in the meantime a stop Felix is requested.
      The code to stop Felix is : getBundle(0).stop()

      By looking at the Thread Dump it appears that iPojo is synchronously dealing with a bundle being stopped while at the same time trying to register a service for that bundle.
      Since the component framework is holding and/or needs its own internal lock when dealing with the stopped bundle and registering the service, we get into a deadlock situation, since both threads also need the bundle lock too.

      ThreadDump (full TD 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)

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

        Attachments

          Activity

            People

            • Assignee:
              clement.escoffier Clement Escoffier
              Reporter:
              dgay David GAY
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: