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

                 Key: SMX4-653
                 URL: https://issues.apache.org/activemq/browse/SMX4-653
             Project: ServiceMix 4
          Issue Type: Improvement
          Components: Bundles
    Affects Versions: 4.4.0
         Environment: Windows 7
            Reporter: Andrei Shakirin


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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to