Sandra created HTTPCLIENT-1954:
----------------------------------

             Summary: Getting Connection Reset and Read timeout with httpclient 
4.5.5
                 Key: HTTPCLIENT-1954
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1954
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: HttpClient (async)
    Affects Versions: 4.5.5
            Reporter: Sandra


Hello,

 

I've been using the httpclient-4.5.5. jar library to create HTTP connections 
and it has been implemented in production environment, but the user is getting 
Connection reset and Read time out exeptions...

 

Do you know something about this kind of exceptions with the 4.5.5 library?

 

java.net.SocketException: Connection reset

        at java.net.SocketInputStream.read(SocketInputStream.java:196)

        at java.net.SocketInputStream.read(SocketInputStream.java:122)

        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:138)

        at 
org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)

        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:165)

        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:272)

        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)

        at 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)

        at 
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)

        at 
com.hp.vzw.spc.nrb.util.HistoricalRequestWork.call(HistoricalRequestWork.java:177)

        at 
com.hp.vzw.spc.nrb.util.HistoricalRequestWork.call(HistoricalRequestWork.java:33)

        at java.util.concurrent.FutureTask.run(FutureTask.java:262)

        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

        at java.lang.Thread.run(Thread.java:745)

Dec 04, 2018 18:48:49 PM [pool-1-thread-25

 

The method to create the connections:

{color:#7f0055}*public*{color} CloseableHttpClient 
createHttpClientHistorical(*{color:#7f0055}int{color}* 
{color:#6a3e3e}JSONTimeout{color})

{

_{color:#0000c0}logger{color}_.info({color:#2a00ff}"Creating http client 
JSONTimeout value received: "{color}+ {color:#6a3e3e}JSONTimeout{color});

*{color:#7f0055}int{color}* {color:#6a3e3e}jsonTimeout{color};

*{color:#7f0055}if{color}* ({color:#6a3e3e}JSONTimeout{color} == 0){

{color:#6a3e3e}jsonTimeout{color} = 
Integer.parseInt(getPropertyFromFile({color:#2a00ff}"JSONTIMEOUT"{color}).trim());

_{color:#0000c0}logger{color}_.info({color:#2a00ff}"Setting JSONTimeout from 
file: "{color}+ {color:#6a3e3e}jsonTimeout{color});

}

*{color:#7f0055}else{color}*{

{color:#6a3e3e}jsonTimeout{color} = {color:#6a3e3e}JSONTimeout{color};

_{color:#0000c0}logger{color}_.info({color:#2a00ff}"Setting JSONTimeout from 
screen: "{color}+ {color:#6a3e3e}jsonTimeout{color});

}

 RequestConfig {color:#6a3e3e}defaultRequestConfig{color} = 
RequestConfig.custom()

 .setConnectTimeout({color:#6a3e3e}jsonTimeout{color})

 .setSocketTimeout({color:#6a3e3e}jsonTimeout{color})

 .setConnectionRequestTimeout({color:#6a3e3e}jsonTimeout{color})

.build();

 CloseableHttpClient {color:#6a3e3e}httpClient{color} = HttpClients.custom() 

 .setDefaultRequestConfig({color:#6a3e3e}defaultRequestConfig{color})

.build();

*{color:#7f0055}return{color}* {color:#6a3e3e}httpClient{color}; 

}

 

Regards,

Sandra H.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to