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 PocketA <gi...@gmail.com> on 2011/06/29 08:34:43 UTC

Stale connection who is to blame ?

Hi All,

In this program that I am writing I use a http client for sending secured
requests to a remote server.
I have no idea what implementation is on this server but I know from its
logs that it recieves my requests.

Problem is that once in a while I see in the httpclient log file that the
socket is stale. On the server logs I see a request rejected (authentication
failed as no user/password sent) but immediately sent again with the needed
credentials and the request is processed succesfully. (In my code I do NOT
send the request twice if an error occurs so I believe this is the mechanism
of httpclient)

My question is :

Who is the one making the connection stale ? Is it the client or the server
and how can I control it ?

Thanks
-- 
View this message in context: http://old.nabble.com/Stale-connection-who-is-to-blame---tp31952205p31952205.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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


Re: Stale connection who is to blame ?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2011-06-28 at 23:34 -0700, PocketA wrote:
> Hi All,
> 
> In this program that I am writing I use a http client for sending secured
> requests to a remote server.
> I have no idea what implementation is on this server but I know from its
> logs that it recieves my requests.
> 
> Problem is that once in a while I see in the httpclient log file that the
> socket is stale. On the server logs I see a request rejected (authentication
> failed as no user/password sent) but immediately sent again with the needed
> credentials and the request is processed succesfully. (In my code I do NOT
> send the request twice if an error occurs so I believe this is the mechanism
> of httpclient)
> 
> My question is :
> 
> Who is the one making the connection stale ? Is it the client or the server
> and how can I control it ?
> 
> Thanks

You can blame green men from Mars, Karl Marx or the nature of the HTTP
protocol and limitations of the blocking I/O model depending on your
inclination. By the HTTP spec either the agent (HTTP client) or the
origin server (HTTP server) can close a persistent connection at any
point of time thus leaving it in a half-closed state. The problem is
that blocking sockets in java cannot react to the opposite endpoint's
connection shutdown until an i/o operation is made on that socket. For a
more detailed technical explanation please see [1]

Oleg

[1] http://markmail.org/message/mvsvbmsy62kjjwvl


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