Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-13466

DefaultCamelContext not stopping all routes on doStop()

    XMLWordPrintableJSON

    Details

    • Estimated Complexity:
      Unknown

      Description

      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 DefaultCamelContext.doStop(), the server is still started and available in /services.

      Tried a fix by adding this line in DefaultCamelContext:3502 :

      // 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
      ...
      

      And now the endpoint isn't available anymore.
      But this fix isn't effective enough as getRouteStartupOrder() may have duplicates?

      Thanks,

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jbonofre Jean-Baptiste Onofré
                Reporter:
                jgreffe Julien Greffe
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m