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: request was sent on stale connection
Date Wed, 10 Jul 2013 11:19:17 GMT
On Tue, 2013-07-09 at 14:37 +0100, Ke Ren wrote:
> Hi,
> 
> We turned off STALE_CONNECTION_CHECK recently and handle failed connection
> with customized retry. It works well most times except one duplicated
> request issue. It fails as the following:
> 
> 1. our code sends a request at 10:54:16,651
> 2. Apache DefaultHttpClient throws I/O exception
> (org.apache.http.NoHttpResponseException) at 10:54:16,735
> 3. DefaultHttpClient invokes retry at 10:54:16,738 and it works.
> 
> However, on server side, we received two identical requests at 10:54:16,658
> and 10:54:16,828.
> 
> My question is if the first connection was stale and closed, how could the
> first request be sent out? If the first connection wasn't closed, why did
> DefaultHttpClient throw I/O exception so quickly?
> 
> Thanks,
> 
> Ke

In classic (blocking) i/o model the only way to find out that the
connection is half-closed is by trying to read from the socket. This is
essentially what the stale check does (and that is why it is expensive
while still being unreliable).

As long as the request is smaller than one TCP frame HttpClient can
write it out to the output buffer of the OS's TCP/IP stack without
realizing the connection is half-closed.

Oleg


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