Uploaded image for project: 'ServiceMix Components'
  1. ServiceMix Components
  2. SMXCOMP-817

HTTP Binding component: processing client timeout on provider side could led to endless loop

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • servicemix-http-2008.01, servicemix-http-2009.01, servicemix-http-2009.02, servicemix-http-2010.01
    • 2010.02
    • servicemix-http
    • None
    • Windows 7

    • Patch Available

    Description

      Hi ServiceMix team,

      I have found one potential issue in SMX http binding component in CXF integration scenario.
      Environment: CXF SE, ServiceMix 4.0.
      Test case: CXF service provider has a long running operation (takes more than client's HTTP timeout).
      1) HTTP binding component receives request from the consumer, creates message exchange, adds it to locks table and sends it to channel (org.apache.servicemix.http.processors.ConsumerProcessor).

      2) After HTTP incoming timeout, ConsumerProcessor is called once more with pending continuation (ContinuationSupport.getContinuation(request, null). By pending continuation exchange is removed from the locks table.

      3) When business method sends response, HTTP binding component is called (ConsumerProcessor.process(MessageExchange exchange)) , checks locks table for exchange, exchange is not found there and it throws exception (throw new Exception("HTTP request has timed out"))

      4) Exception is catched in AsyncBaseLifeCycle (processExchangeInTx), added into exchange and exchange will be sent to channel again.

      Effect in CXF integration: business method will be called in endless loop (there is no explicit check for fault in exchange).

      Proposal: probably it makes sense to change exchange status from ACTIVE to ERROR before send exchange again into channel.
      (method AsyncBaseLifeCycle.processExchangeInTx(), code:
      if (oldStatus == ExchangeStatus.ACTIVE)

      { exchange.setError(t instanceof Exception ? (Exception) t : new Exception(t)); channel.send(exchange); }

      )

      Regards,
      Andrei Shakirin.

      Attachments

        1. AsyncBaseLifeCycle.java.patch
          0.7 kB
          Andrei Shakirin

        Activity

          People

            jb@nanthrax.net Jean-Baptiste Onofré
            ashakirin Andrei Shakirin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: