hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Dever <jsde...@sympatico.ca>
Subject Re: Still problems with HttpRecoverableException and HTTPS
Date Mon, 14 Apr 2003 14:53:14 GMT
I did make that change in 1.44, and remember why.

The write and the read were in the same try/catch in the same retry 
loop.  After 1.44 they were in seperate try/catch with only the write in 
the retry loop.

If the write failed, there would be no read and the loop would retry. 
 If the write succeeded but the read failed, then the entire loop would 
retry again including another write.

The new behaviour was to retry on the write only.  The read would only 
be done after the write succeeded, and would only be done once.  There 
did not seem to be much point in retrying the read since if the write 
was done successfully, but the read fails, then the server should have 
valid data that you cannot read.  

This could be serious if we are talking about a lost transaction.  Say 
you write a credit card payment successfully but can't read for some 
reason.  HttpMethodBase 1.43 would submit it again up to 100 times 
without programmer intervention or knowledge.  The read exception is 
pushed up to the programmer, so they can determine what to do with a 
failed write.

Jandalf.


Aurelien Pernoud wrote:

>Ortwin Gluck a ecrit :
>  
>
>>Michael Becke wrote:
>>    
>>
>>>The obvious best solution would be to figure out a way to determine
>>>if a connection has been closed by the server.
>>>      
>>>
>>The only way to do this, is to perform read / write on the connection,
>>which is sad.
>>    
>>
>
>I totally understand that, but what was different with HttpMultiClient ? Did
>he retried automatically http requests on every case so that I never
>encountered the trouble ?
>I'll take a look at it ... Ok I just did checked out the old nightly I was
>using :
>
>here's the relevant code from httpmethodbase, v1.28:
>
>try{
>  if (!connection.isOpen()) {
>    if (log.isDebugEnabled()) {
>	log.debug("HttpMethodBase.execute(): opening connection.");
>    }
>    connection.open();
>  }
>
>  writeRequest(state,connection);
>  used = true;
>
>  // need to close output?, but when?
>  readResponse(state,connection);
>}catch(HttpRecoverableException e){
>  if(retryCount >= maxRetries){
>    throw new HttpException(e.toString());
>  }
>  retryCount++;
>  connection.close();
>  log.debug("HttpMethodBase.execute():  Caught recoverable exception,
>retrying...");
>  continue;
>}
>the readresponse was in a try/catch, and is not anymore ! The change occured
>in v1.44 :
>
>Revision : 1.44
>Date : 2002/8/7 2:13:22
>Author : 'jsdever'
>State : 'Exp'
>Lines : +110 -74
>Description :
>HttpMethodBase.execute refactoring.
>Reviewed by dIon over discussions on the mailing list.
>
>There seem to have been a discussion over the mailing list, but I wasn't on
>it aymore at that time :)
>
>I'll take a look at archives to know why this change was made.
>
>Aurelien
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org
>
>
>  
>




Mime
View raw message