hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Sutton <adrian.sut...@ephox.com>
Subject RE: HttpRecoverableException: Error in parsing the status line.. .
Date Wed, 05 Feb 2003 04:44:10 GMT
Hi Loren,

>I occasionally get this exception while trying to readResponse() from a
>HttpMethodBase and am trying to learn more about why it happens, and what I
>should do about it. I am using 2.0-a2. I have searched bugzilla and found
>this bug [ http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13463 ] that
>describes it as a race condition.

Hmm, that bug looks like it should now be marked as fixed as that particular
reason for this exception should have been fixed by Michael's? excellent
work that went into 2.0a2 (sorry if I got that name wrong).

>This makes me think that the socket is in fact closed already by the
>server, and HttpMethodBase.execute() doesn't know about it.

Which is exactly what's happening. :)  The problem is that there is no way
to detect if the other side has closed the connection in java except to try
reading/writing to/from the socket.  The trouble with this is that if you
read from the socket and it's open the call blocks and if you write and it's
open you wind up sending an invalid command to the web server which causes
problems anyway.

So the way HttpClient deals with that is to assume the connection is still
open until it gets an exception while reading/writing to/from it in the
normal course of it's work and then it throws a recoverable exception.
Ideally HttpClient would retry when it catches it's own recoverable
exception but there were some design issues with that when I looked at it
last time.  Perhaps it's time to look at it again to see if it can be
achieved now.

In the mean time catching and retrying on the recoverable exception is
required, though contrary to my previous advice you (should) no longer need
to catch and retry on an IOException.

Hope that helps...

Adrian Sutton, Software Engineer
Ephox Corporation
www.ephox.com

Mime
View raw message