hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Silvio Heuberger <silvio.heuber...@hsr.ch>
Subject HTTPClient 4.0.1 sometimes throws SocketTimeOutException while executing POST
Date Thu, 08 Jul 2010 13:14:20 GMT
I have code similar to the following:

     try {
         HttpPost post = new HttpPost(httpsUrl);
         setHeaders(post);

         HttpEntity entity = new StringEntity(request, "UTF-8");

         post.setEntity(entity);

         HttpResponse response = httpclient.execute(post);
         String result = EntityReader.readContent(response.getEntity());
         checkAnswer(result);
         return result;

     } catch (Exception e) {
         throw new ZapException("Error executing the http post request: 
"+e.getMessage(), e);
     }

It sends the content of `request` to a server via POST using a 
httpclient instance that might have already been used before (it has 
persistent connections turned on, since we're sending quite some 
requests to the same server...).

This _sometimes_ fails with a `SocketTimeoutException` with "Read timed 
out" as the message.
It's not clear to us, why it only fails at some times, when _most_ times 
it doesn't. What gives?

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


Mime
View raw message