Uploaded image for project: 'FUSE Mediation Router'
  1. FUSE Mediation Router
  2. MR-903

Exception thrown during endpoint creation leaves exchanges in flight when component is used in the routing slip

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.12.0.redhat-61-xx
    • 2.12.0.redhat-61379
    • None
    • None
    • Hide

      Deploy the following route on Fuse 6.1.0. Use JConsole to monitor the statistics at org.apache.camel/routes/blueprint.xml/routeXXX/. Note that neither totalExchanges nor failedExchanges increments, but inflightExchanges increments without limit, so long as the route is active.

      <?xml version="1.0" encoding="UTF-8"?>
      <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="eager">
      <camelContext xmlns="http://camel.apache.org/schema/blueprint">
      <route>
      <from uri="timer://something?fixedRate=true&period=5000"/>
      <setHeader headerName="endp">
      <constant>file://tmp/test?fileExist=Append&amp;tempPrefix="hello"</constant>
      </setHeader>
      <setBody>
      <constant>Hello, World!</constant>
      </setBody>
      <routingSlip><simple>${header.endp}</simple></routingSlip>
      <to uri="log:XXX?level=ERROR"/>
      </route>
      </camelContext>
      </blueprint>

      If this exercise is repeated on Fuse 6.0.0, the exchanges are actually marked as failed, which is the expected behaviour as an exception is throw.

      Show
      Deploy the following route on Fuse 6.1.0. Use JConsole to monitor the statistics at org.apache.camel/routes/blueprint.xml/routeXXX/. Note that neither totalExchanges nor failedExchanges increments, but inflightExchanges increments without limit, so long as the route is active. <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="eager"> <camelContext xmlns="http://camel.apache.org/schema/blueprint"> <route> <from uri="timer://something?fixedRate=true&period=5000"/> <setHeader headerName="endp"> <constant> file://tmp/test?fileExist=Append&amp;tempPrefix= "hello"</constant> </setHeader> <setBody> <constant>Hello, World!</constant> </setBody> <routingSlip><simple>${header.endp}</simple></routingSlip> <to uri="log:XXX?level=ERROR"/> </route> </camelContext> </blueprint> If this exercise is repeated on Fuse 6.0.0, the exchanges are actually marked as failed, which is the expected behaviour as an exception is throw.

      If a Camel component throws an exception during creation of its endpoint, when that component is invoked by a routing slip, the exchange that led to the endpoint's being created remains permanently in-flight – it is considered neither succeeded nor failed. This problem is not immediately visible, but the bogus in-flight exchanges show up in JMX statistics for the Camel route, and consume memory.

      Consider the createProducer() method of the org.apache.camel.component.file.FileEndpoint class, for example. It can throw an IllegalArgumentException if its attributes are incompatible. If it does so, however, all exchanges passing through the route remain permanently in-flight, even though an exception is thrown and can be handled by the route.

      This problem affects Camel 2.12.0 but does not affect 2.10.0 – it seems that there is some subtle variation in the way that exception handling is done during endpoint creation.

      Although I've used the File component for illustration, this problem affects any component that throws an exception during endpoint creation, if the component is created as a result of a routing slip invocation. Nothing in the documentation suggests that it is not appropriate to throw an exception here.

            cibsen@redhat.com Claus Ibsen
            rhn-support-kboone Kevin Boone
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: