Julien Greffe created CAMEL-13466:
-------------------------------------

             Summary: DefaultCamelContext not stopping all routes on doStop()
                 Key: CAMEL-13466
                 URL: https://issues.apache.org/jira/browse/CAMEL-13466
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.20.1
            Reporter: Julien Greffe
         Attachments: sample-dozer-route-2.0.0-SNAPSHOT.jar

Hello,

after applying CAMEL-12980,

we're still facing an issue with a failing starting feature and the CXFServlet 
{{/services}} URL.

 

To reproduce :
 * drop the attached JAR in deploy
 * wait for bundle start and failure
 * access {{/services}} URL : endpoint + WSDL are listed > is this an expected 
behaviour?

 
 For further analysis, it seems to be something missing in camel-core :

When blueprint fails, the {{doStop()}} method is called :
 
[https://github.com/apache/camel/blob/camel-2.20.1/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java#L3506]
 At that line, it tries to stop only the routes already started, but not the 
ones failing *before* filling {{routeStartupOrder}} List.
 
[https://github.com/apache/camel/blob/camel-2.20.1/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java#L4041]

One of this routes is a CxfConsumer which has already been instanciated, with a 
server creation :
 
[https://github.com/apache/camel/blob/camel-2.20.1/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java#L69]

Even with {{doStop()}}, the server is still started and available in 
{{/services}}.

Tried a fix by adding this line in DefaultCamelContext:3502 :
{code:java}
// fill all the routes to be stopped
getRouteStartupOrder().addAll(routeServices.values().stream().map(this::doPrepareRouteToBeStarted).collect(Collectors.toList()));

// stop route inputs in the same order as they was started so we stop the very 
first inputs first
 try {
 // force shutting down routes as they may otherwise cause shutdown to hang
...
{code}
And now the endpoint isn't available anymore.
 But this fix isn't effective enough as the getRouteStartupOrder() may have 
duplicates?

Thanks,



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to