Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-11782

camel-camel-http4 - Basic / ntlm auth and redelivery issue with streaming message body

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • fuse-7.x-GA
    • Camel
    • None
    • % %
    • Hide

      Reproducer attached. Build and run the camel-springboot-basic-auth example - this is the downstream service, listening on 8090.

      Build and run the camel-springboot-basic-auth-proxy example. This is the proxy / client, listening on port 8187.

      In a rest client, such as Mozilla RESTClient, send a POST request to:

      http://localhost:8187/camel/service1/

      with a comma-delimited payload pair, like:

      test3,node3.example.redhat.com

      The proxy / client application fails with:

      org.apache.http.client.ClientProtocolException: null
      	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
      	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
      	at org.apache.camel.component.http4.HttpProducer.executeMethod(HttpProducer.java:334)
      	at org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:193)
      	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
      	at org.apache.camel.processor.SendDynamicProcessor$1.doInAsyncProducer(SendDynamicProcessor.java:132)
      	at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:445)
      	at org.apache.camel.processor.SendDynamicProcessor.process(SendDynamicProcessor.java:127)
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
      	at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.component.jetty.CamelContinuationServlet.doService(CamelContinuationServlet.java:205)
      	at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:78)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
      	at org.eclipse.jetty.servlets.MultiPartFilter.doFilter(MultiPartFilter.java:150)
      	at org.apache.camel.component.jetty.CamelFilterWrapper.doFilter(CamelFilterWrapper.java:43)
      	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
      	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
      	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
      	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
      	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
      	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
      	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
      	at org.eclipse.jetty.server.Server.handle(Server.java:531)
      	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
      	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
      	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
      	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
      	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:760)
      	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:678)
      	at java.lang.Thread.run(Thread.java:748)
      Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
      	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:226)
      	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
      	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
      	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
      	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
      	... 39 common frames omitted
      

      Enabling streamCaching does not work-around the issue. Only conversion of the payload to a non-stream payload works; however this is not required in the earlier camel-http client and is not documented or obvious to end users.

      Show
      Reproducer attached. Build and run the camel-springboot-basic-auth example - this is the downstream service, listening on 8090. Build and run the camel-springboot-basic-auth-proxy example. This is the proxy / client, listening on port 8187. In a rest client, such as Mozilla RESTClient, send a POST request to: http://localhost:8187/camel/service1/ with a comma-delimited payload pair, like: test3,node3.example.redhat.com The proxy / client application fails with: org.apache.http.client.ClientProtocolException: null at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:187) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) at org.apache.camel.component.http4.HttpProducer.executeMethod(HttpProducer.java:334) at org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:193) at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) at org.apache.camel.processor.SendDynamicProcessor$1.doInAsyncProducer(SendDynamicProcessor.java:132) at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:445) at org.apache.camel.processor.SendDynamicProcessor.process(SendDynamicProcessor.java:127) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) at org.apache.camel.component.jetty.CamelContinuationServlet.doService(CamelContinuationServlet.java:205) at org.apache.camel.http.common.CamelServlet.service(CamelServlet.java:78) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655) at org.eclipse.jetty.servlets.MultiPartFilter.doFilter(MultiPartFilter.java:150) at org.apache.camel.component.jetty.CamelFilterWrapper.doFilter(CamelFilterWrapper.java:43) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.eclipse.jetty.server.Server.handle(Server.java:531) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:760) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:678) at java.lang. Thread .run( Thread .java:748) Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity. at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:226) at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ... 39 common frames omitted Enabling streamCaching does not work-around the issue. Only conversion of the payload to a non-stream payload works; however this is not required in the earlier camel-http client and is not documented or obvious to end users.

    Description

      There is likely a issue if you use http4 producer with basic or ntlm authentication. The message body may be read when sending to the http server, exhausting the stream. Then when the downstream server returns an authentication challenge to the client, the client then attempts to re-submit the request with credentials included. At this point, the message body must be re-sent but due to streaming the body is not re-readable and you can get a NonRepeatableRequestException:

      Caused by: org.apache.http.client.NonRepeatableRequestException: Cannot retry request with a non-repeatable request entity.
      at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:226) ~[?:?]
      at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185) ~[?:?]
      at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[?:?]
      at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111) ~[?:?]
      at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[?:?]
      ... 37 more
      

      Enabling streamCache does not resolve the issue - only conversion of the payload to a non-stream type via processor or converter works around the problem.

      Upstream Issue: https://issues.apache.org/jira/browse/CAMEL-13930

      Attachments

        Activity

          People

            rhn-support-dhawkins Duane Hawkins
            rhn-support-dhawkins Duane Hawkins
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: