You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Sebastien GRIMARD (JIRA)" <ji...@apache.org> on 2012/11/29 15:04:58 UTC
[jira] [Comment Edited] (FELIX-3789) Deadlock due to
synchronization on INSTANCE_NAME
[ https://issues.apache.org/jira/browse/FELIX-3789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13506480#comment-13506480 ]
Sebastien GRIMARD edited comment on FELIX-3789 at 11/29/12 2:04 PM:
--------------------------------------------------------------------
StartupSequencerImpl is one of my classes.
I tried to run the PrimitiveComponentType startup from another thread and it did not solve the problem. The same deadlock still occasionally happens.
New stack trace:
Daemon Thread [Thread-9] (Suspended)
owns: ComponentFactory (id=59)
owns: ArrayList<E> (id=60)
waiting for: HandlerManagerFactory (id=58)
HandlerManagerFactory(IPojoFactory).createComponentInstance(Dictionary, ServiceContext) line: 258
ComponentFactory(IPojoFactory).getHandler(IPojoFactory$RequiredHandler, ServiceContext) line: 830
ComponentFactory(IPojoFactory).createComponentInstance(Dictionary, ServiceContext) line: 306
ComponentFactory(IPojoFactory).createComponentInstance(Dictionary) line: 239
PrimitiveComponentType(ComponentType).createInstance() line: 79
COI_Starter$1.run() line: 191
Daemon Thread [Thread-1] (Suspended)
owns: HandlerManagerFactory (id=58)
owns: ComponentFactory (id=61)
owns: HandlerManagerFactory (id=62)
waiting for: ArrayList<E> (id=60)
HandlerManagerFactory(IPojoFactory).createComponentInstance(Dictionary, ServiceContext) line: 283
ComponentFactory(IPojoFactory).getHandler(IPojoFactory$RequiredHandler, ServiceContext) line: 830
ComponentFactory(IPojoFactory).computeDescription() line: 721
ComponentFactory(IPojoFactory).computeFactoryState() line: 757
ComponentFactory.addedService(ServiceReference) line: 414
Tracker$Tracked.trackAdding(ServiceReference) line: 725
Tracker$Tracked.track(ServiceReference) line: 686
Tracker$Tracked.serviceChanged(ServiceEvent) line: 642
FilteredServiceListener.serviceChanged(ServiceEvent) line: 107
BundleContextImpl.dispatchEvent(Object, Object, int, Object) line: 861
EventManager.dispatchEvent(Set, EventDispatcher, int, Object) line: 230
ListenerQueue.dispatchEventSynchronous(int, Object) line: 148
ServiceRegistry.publishServiceEventPrivileged(ServiceEvent) line: 819
ServiceRegistry.publishServiceEvent(ServiceEvent) line: 771
ServiceRegistrationImpl.register(Dictionary) line: 130
ServiceRegistry.registerService(BundleContextImpl, String[], Object, Dictionary) line: 214
BundleContextImpl.registerService(String[], Object, Dictionary) line: 433
HandlerManagerFactory(IPojoFactory).start() line: 613
Extender.createAbstractFactory(Bundle, Element) line: 520
Extender.parse(Bundle, String) line: 301
Extender.startManagementFor(Bundle) line: 237
Extender.access$600(Extender, Bundle) line: 52
Extender$CreatorThread.run() line: 769
Thread.run() line: 662
was (Author: seb64):
StartupSequencerImpl is one of my classes.
I tried to run the PrimitiveComponentType startup from another thread and it did not solve the problem. The same deadlock still occasionally happens.
> Deadlock due to synchronization on INSTANCE_NAME
> ------------------------------------------------
>
> Key: FELIX-3789
> URL: https://issues.apache.org/jira/browse/FELIX-3789
> Project: Felix
> Issue Type: Bug
> Components: iPOJO
> Affects Versions: ipojo-core-1.8.4
> Reporter: Sebastien GRIMARD
>
> iPojo sometimes locks up during component instanciation in our application.
> After analysis, the lockup occurs since the fix in FELIX-3548 was applied.
> The problem is that createComponentInstance in the class IPojoFactory is pseudo-recursive (through a call to getHandler), that is it can call recursively itself on a different factory instance.
> Since createComponentInstance synchronizes itself on the factory first (local lock) and on INSTANCE_NAME second (global lock), sometimes it will try to call createComponentInstance on a different factory while holding the global lock and while another threads holds that factory's local lock and is trying to acquire the global lock (I hope what I wrote makes sense).
> Stack trace of the problem :
> Daemon Thread [Thread-1] (Suspended)
> owns: ComponentFactory (id=5717)
> owns: ArrayList<E> (id=5708) <==============
> owns: HandlerManagerFactory (id=5718)
> waiting for: HandlerManagerFactory (id=5709) <==============
> HandlerManagerFactory(IPojoFactory).createComponentInstance(Dictionary,
> ServiceContext) line: 258
> ComponentFactory(IPojoFactory).getHandler(IPojoFactory$RequiredHandler,
> ServiceContext) line: 830
> ComponentFactory(IPojoFactory).createComponentInstance(Dictionary,
> ServiceContext) line: 306
> ComponentFactory(IPojoFactory).createComponentInstance(Dictionary)
> line: 239
> InstanceCreator$ManagedInstance.create(IPojoFactory) line: 343
> InstanceCreator.onValidation(IPojoFactory) line: 202
> InstanceCreator.stateChanged(Factory, int) line: 243
> ComponentFactory(IPojoFactory).computeFactoryState() line: 766
> ComponentFactory.addedService(ServiceReference) line: 414
> Tracker$Tracked.trackAdding(ServiceReference) line: 725
> Tracker$Tracked.track(ServiceReference) line: 686
> Tracker$Tracked.serviceChanged(ServiceEvent) line: 642
> FilteredServiceListener.serviceChanged(ServiceEvent) line: 107
> BundleContextImpl.dispatchEvent(Object, Object, int, Object) line: 861
> EventManager.dispatchEvent(Set, EventDispatcher, int, Object) line:
> 230
> ListenerQueue.dispatchEventSynchronous(int, Object) line: 148
> ServiceRegistry.publishServiceEventPrivileged(ServiceEvent) line: 819
> ServiceRegistry.publishServiceEvent(ServiceEvent) line: 771
> ServiceRegistrationImpl.register(Dictionary) line: 130
> ServiceRegistry.registerService(BundleContextImpl, String[], Object,
> Dictionary) line: 214
> BundleContextImpl.registerService(String[], Object, Dictionary) line:
> 433
> HandlerManagerFactory(IPojoFactory).start() line: 613
> Extender.createAbstractFactory(Bundle, Element) line: 520
> Extender.parse(Bundle, String) line: 301
> Extender.startManagementFor(Bundle) line: 237
> Extender.access$600(Extender, Bundle) line: 52
> Extender$CreatorThread.run() line: 769
> Thread.run() line: 662
> Daemon Thread [Thread-7] (Suspended)
> owns: HandlerManagerFactory (id=5709) <==============
> owns: ComponentFactory (id=5710)
> owns: Tracker (id=5711)
> owns: Dependency[] (id=5712)
> waiting for: ArrayList<E> (id=5708) <==============
> HandlerManagerFactory(IPojoFactory).createComponentInstance(Dictionary,
> ServiceContext) line: 283
> ComponentFactory(IPojoFactory).getHandler(IPojoFactory$RequiredHandler,
> ServiceContext) line: 830
> ComponentFactory(IPojoFactory).computeDescription() line: 721
> ComponentFactory(IPojoFactory).computeFactoryState() line: 757
> ComponentFactory.addedService(ServiceReference) line: 414
> Tracker$Tracked.trackAdding(ServiceReference) line: 725
> Tracker$Tracked.trackInitialServices() line: 610
> Tracker.open() line: 210
> ComponentFactory.starting() line: 262
> ComponentFactory(IPojoFactory).start() line: 605
> PrimitiveComponentType.createFactory() line: 441
> PrimitiveComponentType.initializeFactory() line: 198
> PrimitiveComponentType.getFactory() line: 171
> PrimitiveComponentType(ComponentType).ensureFactory() line: 185
> PrimitiveComponentType(ComponentType).ensureAndGetFactory() line: 177
> PrimitiveComponentType(ComponentType).createInstance() line: 79
> COI_Starter.__M_coiBuildler(COI_ConfigLoader) line: 176
> COI_Starter.coiBuildler(COI_ConfigLoader) line: not available
> COI_Starter.__M_startOSGI() line: 97
> COI_Starter.startOSGI() line: not available
> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
> Method.invoke(Object, Object...) line: 597
> Callback.call(Object[]) line: 233
> Callback.call() line: 193
> LifecycleCallback.call() line: 86
> LifecycleCallbackHandler.__M_stateChanged(int) line: 162
> LifecycleCallbackHandler.stateChanged(int) line: not available
> InstanceManager.setState(int) line: 535
> InstanceManager.stateChanged(ComponentInstance, int) line: 1401
> HandlerManager(InstanceManager).setState(int) line: 560
> HandlerManager.stateChanged(ComponentInstance, int) line: 239
> DependencyHandler(Handler).setValidity(boolean) line: 174
> DependencyHandler.__M_checkContext() line: 186
> DependencyHandler.checkContext() line: not available
> DependencyHandler.__M_validate(DependencyModel) line: 149
> DependencyHandler.validate(DependencyModel) line: not available
> Dependency(DependencyModel).validate() line: 642
> Dependency(DependencyModel).computeDependencyState() line: 310
> Dependency(DependencyModel).manageArrival(ServiceReference) line: 399
> Dependency(DependencyModel).addedService(ServiceReference) line: 335
> Tracker$Tracked.trackAdding(ServiceReference) line: 725
> Tracker$Tracked.track(ServiceReference) line: 686
> Tracker$Tracked.serviceChanged(ServiceEvent) line: 647
> FilteredServiceListener.serviceChanged(ServiceEvent) line: 107
> BundleContextImpl.dispatchEvent(Object, Object, int, Object) line: 861
> EventManager.dispatchEvent(Set, EventDispatcher, int, Object) line:
> 230
> ListenerQueue.dispatchEventSynchronous(int, Object) line: 148
> ServiceRegistry.publishServiceEventPrivileged(ServiceEvent) line: 819
> ServiceRegistry.publishServiceEvent(ServiceEvent) line: 771
> ServiceRegistrationImpl.register(Dictionary) line: 130
> ServiceRegistry.registerService(BundleContextImpl, String[], Object,
> Dictionary) line: 214
> BundleContextImpl.registerService(String[], Object, Dictionary) line:
> 433
> BundleContextImpl.registerService(String, Object, Dictionary) line:
> 451
> IPojoContext.registerService(String, Object, Dictionary) line: 404
> StartupSequencerImpl$SequenceThread.launchStartupPhase(StartupPhase)
> line: 309
> StartupSequencerImpl$SequenceThread.runStartup() line: 389
> StartupSequencerImpl$SequenceThread.run() line: 262
--
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