Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.10.3
-
None
-
Patch Available
-
Unknown
Description
We observed a deadlock situation that seems to be caused by the change that came in with CAMEL-5712, which changed the way how CamelBlueprintContext is started to solve another issue.
The current code listens to the service registered event for org.osgi....BlueprintContainer (supposedly for its associated BP container) and decides to start itself if not started. From the description of the ticket, this change was intended to make sure the starting of the context occurs after its BP container is registered.
In that case, should it be checking whether the received event belongs to the same bundle? This checking is missing in the current code and consequently, it may wrongly react to the event from another bundle's container registration event. When this happens under some specific timing situation, it may also lead to a deadlock.
So, should we be checking the event source in CamelBlueprintContext's serviceChanged method?
Regards, aki
Stack trace from 2.10.3
========================================================================
Name: Blueprint Extender: 3
State: BLOCKED on java.lang.Object@9064b42 owned by: Blueprint Extender: 2
Total blocked: 13 Total waited: 38
Stack trace:
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:212)
org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:198)
org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:137)
org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:709)
org.apache.camel.blueprint.BlueprintContainerRegistry.lookup(BlueprintContainerRegistry.java:41)
org.apache.camel.impl.CompositeRegistry.lookup(CompositeRegistry.java:68)
org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookup(PropertyPlaceholderDelegateRegistry.java:49)
org.apache.camel.blueprint.BlueprintComponentResolver.resolveComponent(BlueprintComponentResolver.java:39)
org.apache.camel.impl.DefaultCamelContext.getComponent(DefaultCamelContext.java:314)
- locked java.util.HashMap@1660de94org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:456)
org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:50)
org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:186)
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:108)
org.apache.camel.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:114)
org.apache.camel.model.FromDefinition.resolveEndpoint(FromDefinition.java:72)
org.apache.camel.impl.DefaultRouteContext.getEndpoint(DefaultRouteContext.java:90)
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:851)
org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:171)
org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:722)
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1789)
org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1575)
org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1444) - locked org.apache.camel.blueprint.BlueprintCamelContext@5011bafaorg.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1412)
org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:127)
org.apache.camel.blueprint.BlueprintCamelContext.serviceChanged(BlueprintCamelContext.java:96)
org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(FilteredServiceListener.java:104)
org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:861)
org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(ServiceRegistry.java:819)
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(ServiceRegistry.java:771)
org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:130)
org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:214)
org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:433)
org.apache.aries.blueprint.container.BlueprintContainerImpl.registerService(BlueprintContainerImpl.java:410)
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:346)
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:230) - locked java.util.concurrent.atomic.AtomicBoolean@3cb3ada
- locked java.util.concurrent.atomic.AtomicBoolean@31b4d206
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:722)
========================================================================
Name: Blueprint Extender: 2
State: BLOCKED on
org.apache.camel.blueprint.BlueprintCamelContext@5011bafa owned by: Blueprint Extender: 3
Total blocked: 24 Total waited: 58
Stack trace:
org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:1053)
org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:249)
org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:222)
org.apache.camel.component.file.GenericFileComponent.createEndpoint(GenericFileComponent.java:64)
org.apache.camel.component.file.GenericFileComponent.createEndpoint(GenericFileComponent.java:36)
org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:91)
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:461)
org.apache.camel.core.xml.AbstractCamelEndpointFactoryBean.getObject(AbstractCamelEndpointFactoryBean.java:46)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:226)
org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:824)
org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:234)
org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:706)
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)
- locked java.lang.Object@9064b42
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219) - locked java.lang.Object@9064b42
org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147)
org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:631)
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:337)
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:230) - locked java.util.concurrent.atomic.AtomicBoolean@53b00227
- locked java.util.concurrent.atomic.AtomicBoolean@5648a168
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:722)