hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Kalnichevski (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (HTTPCORE-237) Getting very frequent SocketTimeOutException
Date Tue, 28 Sep 2010 21:44:34 GMT

     [ https://issues.apache.org/jira/browse/HTTPCORE-237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Oleg Kalnichevski resolved HTTPCORE-237.
----------------------------------------

    Resolution: Invalid

Simona

This is because the socket timeout value set by your application must be too aggressive (too
low). This is most certainly not a bug in HttpCore. Try increasing the socket timeout.

Oleg

> Getting very frequent SocketTimeOutException
> --------------------------------------------
>
>                 Key: HTTPCORE-237
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-237
>             Project: HttpComponents HttpCore
>          Issue Type: Bug
>          Components: HttpCore
>    Affects Versions: 4.0.1, 4.0.2
>         Environment: PROD
>            Reporter: Simona Afifi
>
> We are using ThreadSafeClientConnManager and we close the stream at the finally block
and yet we see very frequent occurences of this exception:
> java.net.SocketTimeoutException: Read timed out
>         at java.net.SocketInputStream.socketRead0(Native Method)
>         at java.net.SocketInputStream.read(SocketInputStream.java:129)
>         at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:130)
>         at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:127)
>         at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:233)
>         at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:98)
>         at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:210)
>         at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:271)
>         at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:227)
>         at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:209)
>         at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:292)
>         at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:126)
>         at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:483)
>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
>         at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
> Sample code:
> HttpClientWrapper.class
>  public HttpResponse execute(HttpPost httpPost, int timeout) throws IOException {   
    
>         HttpClient httpClient = new DefaultHttpClient(connManager, initParams(timeout));
>         httpClient.getConnectionManager().closeExpiredConnections();
>         return httpClient.execute(httpPost);
>     }
> Service.class
> -------------------
> private String invokeHttpGet(HttpGet httpGet) throws Exception {
>         String responseStr="";
>         HttpEntity entity= null;
>         try{
>             HttpResponse response = httpClientWrapper.execute(httpGet);
>             entity = response.getEntity();
>             if (entity != null) {                
>                 responseStr = EntityUtils.toString(entity);
>             }    
>         }catch(Exception e){
>             if(httpGet!=null)
>                 httpGet.abort();
>     
>             throw e;
>         }finally{
>             if(entity!=null) entity.consumeContent();
>         }
>         return responseStr;
>     }

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message