You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Luca Burgazzoli (JIRA)" <ji...@apache.org> on 2017/05/03 07:46:04 UTC

[jira] [Created] (CAMEL-11225) Deadlock in component creation

Luca Burgazzoli created CAMEL-11225:
---------------------------------------

             Summary: Deadlock in component creation 
                 Key: CAMEL-11225
                 URL: https://issues.apache.org/jira/browse/CAMEL-11225
             Project: Camel
          Issue Type: Bug
          Components: camel-core, camel-spring
            Reporter: Luca Burgazzoli
            Assignee: Luca Burgazzoli
             Fix For: 2.20.0


There are circumstances in which the component creation could enter in a deadlock, let's have a look at the following spring example:  

{code:xml}
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
         http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
 
  <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
    <route id="twitter-route">
      <from id="twitter" uri="twitter://timeline/home?type=polling"/>
      <log id="route-log" message="Got ${body}"/>
    </route>
  </camelContext>
 
</beans>
{code}

The critical part is:

{code:xml}
  <from id="twitter" uri="twitter://timeline/home?type=polling"/>
{code}

What happens is that:
- because there is an id, camel registers a CamelEndpointFactoryBean to the spring application contex
- the endpoint is then resolved which involve the  instantiation of the component (twitter in this case) which invoke CamelContext.getComponent
- when the component is being created it then uses the component resolver which goes down to the registry to find out if the requested component is already there
- as in the registry there is a bean factory with the same name as the component we want to create, spring invokes the factory which then goes down to CamelContext.getComponent
- then deadlock 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)