hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject RE: Sometimes response timeout seems to not work
Date Tue, 23 Mar 2010 14:07:03 GMT
On Tue, 2010-03-23 at 14:53 +0100, Joan Balaguero wrote:
> Hello Oleg,
> 
> Your definition of http.socket.timeout is the maximum period of inactivity between two
consecutive data packets.
> 

This is not my definition. I believe this is a fairly common / standard
definition of the socket timeout.

> Do you mean that, maybe, the response packets are received in long intervals (always
less than 60 seconds), and then the exception is not thrown but the response time could take
several minutes?
> 

Yes, I do.

Oleg

> Thanks,
> Joan.
> 
> -----Mensaje original-----
> De: Oleg Kalnichevski [mailto:olegk@apache.org] 
> Enviado el: martes, 23 de marzo de 2010 14:37
> Para: HttpClient User Discussion
> Asunto: Re: Sometimes response timeout seems to not work
> 
> On Tue, 2010-03-23 at 14:31 +0100, Joan Balaguero wrote:
> > Hello,
> > 
> >  
> > 
> > We're querying  a webservice using a 'ThreadSafeClientConnManager'. 
> > 
> > Platform: windows 2003 Server 64bit
> > 
> > httpClient 4.0
> > 
> > jre 6 update 13 on Tomcat 6.0.18
> > 
> >  
> > 
> > We're setting a global response timeout with:
> > 
> > HttpParams objHttpParams = new BasicHttpParams();
> > 
> > HttpProtocolParams.setVersion(objHttpParams, HttpVersion.HTTP_1_1);
> > 
> > HttpConnectionParams.setSoTimeout(objHttpParams, responseTimeout);
> > 
> > ClientConnectionManager cm = new ThreadSafeClientConnManager(objHttpParams,
> > HttpUtils.createDefaultSchemeRegistry());
> > 
> > this.objHttp                = new DefaultHttpClient(cm, objHttpParams);
> > 
> >  
> > 
> > For every webservice call, if the response timeout (at call level) is
> > greater than 0 then:
> > 
> > if (objCall.responseTimeout != 0)
> > objPost.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
> > objCall.responseTimeout); 
> > 
> >  
> > 
> > Then we send the request:
> > 
> > StringEntity entity = new StringEntity(request.createRequestParameters());
> > 
> > entity.setContentType(request.contentType);
> > 
> > objPost.setEntity(entity);
> > 
> >           
> > 
> > return (this.objHttp.execute(objPost));
> > 
> >  
> > 
> > And we read the response:
> > 
> > bis                          = new BufferedInputStream(entity.getContent());
> > 
> > ByteArrayOutputStream buffer = new ByteArrayOutputStream(httpOutBufferSize);
> > 
> > byte[] tmp                   = new byte[httpOutBufferSize];
> > 
> > int numBytesRead             = 0;
> > 
> >  
> > 
> > while ((numBytesRead = bis.read(tmp)) >= 0) buffer.write(tmp, 0,
> > numBytesRead);
> > 
> > bis.close();
> > 
> > bis = null;
> > 
> >  
> > 
> > 
> > 
> > Performing a thread dump, we can see many threads blocked waiting a response
> > several minutes (2,3,4 minutes) when the maximum response timeout is 60
> > seconds (at webservice and call level).
> > 
> 
> Please see definition of the socket timeout
> 
> Oleg
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 9.0.791 / Virus Database: 271.1.1/2764 - Release Date: 03/22/10 20:44:00
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
> 



---------------------------------------------------------------------
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