You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Aurelien Pernoud <ap...@sopragroup.com> on 2003/04/15 18:45:38 UTC

Some more infos on writing on closed socket

Here is what I have here in some case :

httpclient side : win 2000 pro, jdk 1.3.1b24
server side : win 2000 server,  jdk 1.3.1b24, tomcat 4.1.9 (i tried it with
4.1.24, same result)
everything intranet, reliable network ;)

* While connection is in ESTABLISHED, everything ok (with as many requests
as I want)

I wait a little, for it to time out (there I think tomcat times out it, as I
didn't set any timeout on httpconnection nor httpmethod) :

The connection is shown as CLOSED_WAIT on the httpclient side, FIN_WAIT_2 on
the server side
Httpclient writes the request (it's impossible, but I wanted to check so I
went on the server side -> nothing appeared) and, when reading, get a null
statusstring and the HTTP exception reading response.

The connection then isn't anymore there on the client side, BUT is still
there on the server side, gone from FIN_WAIT_2 to TIME_WAIT ???

Then httpclient uses a new connection, and everything goes fine.

Something really weird : If I wait again (the bug only occurs sometimes but
I found a way to reproduce it at least once), the connection is shown as
above (CLOSED_WAIT on httpclient side, FIN_WAIT_2 on server side), and this
time httpclient fails to write the request...

until the next "weird case" :(

I've checked too for inputstream.available() before writing request, it
always return 0, wether the connection is down or not ...
I'll test the SO_KEEPALIVE tomorrow on the socket used, see if it helps ?
Although I'm not sure of the subsequences of that KEEPALIVE option ?

I'll keep you guys in touch if I ever find something, but right now I simply
don't get it :)

Aurelien