Hello

I'm trying to understand if the v3, which my application currently
uses, handles Keep-Alive properly - because our client says it does
not.

On several requests, using lsof, I can see that httpclient connections
in state ESTABLISHED gradually fall back to a CLOSE_WAIT state, and
they also stay in this state, unless I explicitely call
org.apache.commons.httpclient.MultiThreadedHttpConnectionManager#closeIdleConnections.
A question : if Keep-Alive was working properly, should the
connections stay in ESTABLISHED forever ?

By looking at the source,
org.apache.commons.httpclient.HttpMethodBase#shouldCloseConnection
looks correct, we are using HTTP/1.1, it implies connections are
persistent.
However, org.apache.commons.httpclient.HttpConnection#closeIfStale
seems to think connections are staled, hence closing them, so it's not
reusing them. I don't understand the
org.apache.commons.httpclient.HttpConnection#isStale part, with
socket.setSoTimeout(1);/inputStream.mark(1);/inputStream.read() : why
is the timeout set to 1 and how would it affect the read ?

Is the stale checking code broken in v3, breaking connections reuse ?
I've read the Connection keep alive strategy chapter at
http://hc.apache.org/httpcomponents-client/tutorial/html/connmgmt.html,
and I can't figure out if v4 fixes it or not : if v4 assumes it can
keep the connection forever, will it still do a stale check ?

Thanks for your input
laurent


-- 
<a href="http://blog.jdeuxe.info/";>http://blog.jdeuxe.info/ - Java
entreprise tips & tricks</a>

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

Reply via email to