You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by "KARR, DAVID (ATTSI)" <dk...@att.com> on 2010/05/18 23:36:42 UTC

With HttpClient 3.0.1, is there some situation where setting the "SoTimeout" would be ignored?

I'm looking at a situation where I'm setting the "SoTimeout" in
HttpClientParams to 90000 (90 seconds).  This makes a call to a web
service that under certain circumstances takes quite a while to
complete, and sometimes times out.  In fact, the data in my log file
indicates that I often get start-to-return intervals of just about 120
seconds.  If the back-end server is still working on the request after
90 seconds, will HttpClient be able to cause the request to abort?

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


RE: With HttpClient 3.0.1, is there some situation where setting the "SoTimeout" would be ignored?

Posted by "KARR, DAVID (ATTSI)" <dk...@att.com>.
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org]
> Sent: Tuesday, May 18, 2010 3:04 PM
> To: HttpClient User Discussion
> Subject: Re: With HttpClient 3.0.1, is there some situation where
> setting the "SoTimeout" would be ignored?
> 
> On Tue, 2010-05-18 at 14:36 -0700, KARR, DAVID (ATTSI) wrote:
> > I'm looking at a situation where I'm setting the "SoTimeout" in
> > HttpClientParams to 90000 (90 seconds).  This makes a call to a web
> > service that under certain circumstances takes quite a while to
> > complete, and sometimes times out.  In fact, the data in my log file
> > indicates that I often get start-to-return intervals of just about
> 120
> > seconds.  If the back-end server is still working on the request
> after
> > 90 seconds, will HttpClient be able to cause the request to abort?
> >
> 
> David,
> 
> The setting is not ignored, rather your expectation is wrong. The
> socket
> timeout is the maximum period of inactivity between two _consecutive_
> data transmissions. As long as the server sends a packet every 90
> seconds the request will not time out.
> 
> Hope this clarifies things a little

I'm getting back to examining this issue again.

I may need to implement a way to actually force the connection to terminate with prejudice after our "read timeout" value, so that we're interpreting that "read timeout" for the entire transaction, not just for a single packet.  Is there an obvious way to implement something like this?

I noticed the "closeIdleConnections()" method in "SimpleHttpConnectionManager".  If I have a background thread call this if it has passed its timeout value, would that work?  I assume I would implement this with a blocking queue holding HttpClient objects along with their start time.

RE: With HttpClient 3.0.1, is there some situation where setting the "SoTimeout" would be ignored?

Posted by "KARR, DAVID (ATTSI)" <dk...@att.com>.
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org]
> Sent: Tuesday, May 18, 2010 3:04 PM
> To: HttpClient User Discussion
> Subject: Re: With HttpClient 3.0.1, is there some situation where
> setting the "SoTimeout" would be ignored?
> 
> On Tue, 2010-05-18 at 14:36 -0700, KARR, DAVID (ATTSI) wrote:
> > I'm looking at a situation where I'm setting the "SoTimeout" in
> > HttpClientParams to 90000 (90 seconds).  This makes a call to a web
> > service that under certain circumstances takes quite a while to
> > complete, and sometimes times out.  In fact, the data in my log file
> > indicates that I often get start-to-return intervals of just about
> 120
> > seconds.  If the back-end server is still working on the request
> after
> > 90 seconds, will HttpClient be able to cause the request to abort?
> >
> 
> David,
> 
> The setting is not ignored, rather your expectation is wrong. The
> socket
> timeout is the maximum period of inactivity between two _consecutive_
> data transmissions. As long as the server sends a packet every 90
> seconds the request will not time out.
> 
> Hope this clarifies things a little

Yup, that clarifies this perfectly.  Thanks.


Re: With HttpClient 3.0.1, is there some situation where setting the "SoTimeout" would be ignored?

Posted by sebb <se...@gmail.com>.
On 19/05/2010, KARR, DAVID (ATTSI) <dk...@att.com> wrote:
> > -----Original Message-----
>  > From: Oleg Kalnichevski [mailto:olegk@apache.org]
>  > Sent: Tuesday, May 18, 2010 3:04 PM
>  > To: HttpClient User Discussion
>  > Subject: Re: With HttpClient 3.0.1, is there some situation where
>  > setting the "SoTimeout" would be ignored?
>  >
>
> > On Tue, 2010-05-18 at 14:36 -0700, KARR, DAVID (ATTSI) wrote:
>  > > I'm looking at a situation where I'm setting the "SoTimeout" in
>  > > HttpClientParams to 90000 (90 seconds).  This makes a call to a web
>  > > service that under certain circumstances takes quite a while to
>  > > complete, and sometimes times out.  In fact, the data in my log file
>  > > indicates that I often get start-to-return intervals of just about
>  > 120
>  > > seconds.  If the back-end server is still working on the request
>  > after
>  > > 90 seconds, will HttpClient be able to cause the request to abort?
>  > >
>  >
>  > David,
>  >
>  > The setting is not ignored, rather your expectation is wrong. The
>  > socket
>  > timeout is the maximum period of inactivity between two _consecutive_
>  > data transmissions. As long as the server sends a packet every 90
>  > seconds the request will not time out.
>
>
> Even with this, I'm wondering what's going on here.  All of my transactions are web service calls, where the entire response is sent at once.  Even with a very slow intranet, I can't see a response taking more than 10-20 seconds to transmit.  I'm setting the SoTimeout to 90 seconds, and I'm finding calls in production that are taking well over that, up to 155 seconds, for instance.

But the server could have sent back the response in dribs and drabs,
which would keep the connection alive. Perhaps use a protocol analyser
to check this?

Just wondering: does the Socket code take account of KeepAlive packets
when calculating timeouts? Or only data packets?

Again, a protocol analyser should show these.

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


RE: With HttpClient 3.0.1, is there some situation where setting the "SoTimeout" would be ignored?

Posted by "KARR, DAVID (ATTSI)" <dk...@att.com>.
> -----Original Message-----
> From: Oleg Kalnichevski [mailto:olegk@apache.org]
> Sent: Tuesday, May 18, 2010 3:04 PM
> To: HttpClient User Discussion
> Subject: Re: With HttpClient 3.0.1, is there some situation where
> setting the "SoTimeout" would be ignored?
> 
> On Tue, 2010-05-18 at 14:36 -0700, KARR, DAVID (ATTSI) wrote:
> > I'm looking at a situation where I'm setting the "SoTimeout" in
> > HttpClientParams to 90000 (90 seconds).  This makes a call to a web
> > service that under certain circumstances takes quite a while to
> > complete, and sometimes times out.  In fact, the data in my log file
> > indicates that I often get start-to-return intervals of just about
> 120
> > seconds.  If the back-end server is still working on the request
> after
> > 90 seconds, will HttpClient be able to cause the request to abort?
> >
> 
> David,
> 
> The setting is not ignored, rather your expectation is wrong. The
> socket
> timeout is the maximum period of inactivity between two _consecutive_
> data transmissions. As long as the server sends a packet every 90
> seconds the request will not time out.

Even with this, I'm wondering what's going on here.  All of my transactions are web service calls, where the entire response is sent at once.  Even with a very slow intranet, I can't see a response taking more than 10-20 seconds to transmit.  I'm setting the SoTimeout to 90 seconds, and I'm finding calls in production that are taking well over that, up to 155 seconds, for instance.

Re: With HttpClient 3.0.1, is there some situation where setting the "SoTimeout" would be ignored?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2010-05-18 at 14:36 -0700, KARR, DAVID (ATTSI) wrote:
> I'm looking at a situation where I'm setting the "SoTimeout" in
> HttpClientParams to 90000 (90 seconds).  This makes a call to a web
> service that under certain circumstances takes quite a while to
> complete, and sometimes times out.  In fact, the data in my log file
> indicates that I often get start-to-return intervals of just about 120
> seconds.  If the back-end server is still working on the request after
> 90 seconds, will HttpClient be able to cause the request to abort?
> 

David,

The setting is not ignored, rather your expectation is wrong. The socket
timeout is the maximum period of inactivity between two _consecutive_
data transmissions. As long as the server sends a packet every 90
seconds the request will not time out.

Hope this clarifies things a little

Oleg


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