Hi,

I have a custom load balancer created using Camel that looks something like
the following:

from("jetty:
https://0.0.0.0:443?matchOnUriPrefix=true&enableMultipartFilter=false
").loadBalance(new MyLoadBalancer())
    
.to("http4://localhost:7777?bridgeEndpoint=true&throwExceptionOnFailure=false",
"http4://localhost:7778?bridgeEndpoint=true&throwExceptionOnFailure=false",
"http4://localhost:7779?bridgeEndpoint=true&throwExceptionOnFailure=false");

(I've simplified the above code to not distract from my original problem).

The incoming request is routed to one of the http4 producers based on some
logic. For the most part, things seem to be working fine and the proper
response is sent back to the user. However some requests, error out inside
camel with the following exception:

java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:209)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at
org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:139)
    at
org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:155)
    at
org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:284)
    at
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
    at
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
    at
org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
    at
org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:165)
    at
org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:167)
    at
org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
    at
org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
    at
org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:271)
    at
org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
    at
org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at
org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
    at
org.apache.camel.component.http4.HttpProducer.executeMethod(HttpProducer.java:278)
    at
org.apache.camel.component.http4.HttpProducer.process(HttpProducer.java:164)
    at org.me.app.MyLoadBalancer.processRequest(MyLoadBalancer.java:50)

Prior to using HTTP4 for the producer endpoints, I was using Jetty Http
Component and I wasn't getting this problem and I can see this in the logs
only after I shifted to HTTP4. Can someone please help me with what could
be the problem? Do I need to do something else to make HTTP4 work properly
in my case?

Thanks!

PS: I mailed the content from a mail ID which I had not subscribed to Camel
maillist from. I suppose that mail will be discarded, hence I am resending
this mail from the original email ID I had used to subscribe to this list.
In case my subject appears twice in the forum, please accept my apologies.

Reply via email to