You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by sebb <se...@gmail.com> on 2011/08/30 22:06:14 UTC

Should HC retry all SocketExceptions?

The method DefaultHttpRequestRetryHandler.retryRequest currently
retries IOExceptions which are not:

InterruptedIOException
UnknownHostException
ConnectException
SSLException

However, this includes exceptions such as the following:

org.apache.http.impl.client.DefaultHttpClient: I/O exception
(java.net.SocketException) caught when processing request: socket
closed
org.apache.http.impl.client.DefaultHttpClient: Retrying request

and

org.apache.http.impl.client.DefaultHttpClient: I/O exception
(java.net.BindException) caught when connecting to the target host:
Address already in use: connect
org.apache.http.impl.client.DefaultHttpClient: Retrying connect

which seems wrong (but perhaps I am wrong).

I discovered this because JMeter currently uses Socket.close() to
interrupt an active sample. Probably there is a better way to do this.

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


Re: Should HC retry all SocketExceptions?

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Tue, 2011-08-30 at 21:47 +0100, sebb wrote:
> On 30 August 2011 21:06, sebb <se...@gmail.com> wrote:
> > The method DefaultHttpRequestRetryHandler.retryRequest currently
> > retries IOExceptions which are not:
> >
> > InterruptedIOException
> > UnknownHostException
> > ConnectException
> > SSLException
> >
> > However, this includes exceptions such as the following:
> >
> > org.apache.http.impl.client.DefaultHttpClient: I/O exception
> > (java.net.SocketException) caught when processing request: socket
> > closed
> > org.apache.http.impl.client.DefaultHttpClient: Retrying request
> >
> > and
> >
> > org.apache.http.impl.client.DefaultHttpClient: I/O exception
> > (java.net.BindException) caught when connecting to the target host:
> > Address already in use: connect
> > org.apache.http.impl.client.DefaultHttpClient: Retrying connect
> >
> > which seems wrong (but perhaps I am wrong).
> >

Yes, this is wrong. In both cases the exception should not have been
retried.


> > I discovered this because JMeter currently uses Socket.close() to
> > interrupt an active sample. Probably there is a better way to do this.
> 
> Sorry, that's misleading - JMeter uses HttpUriRequest.abort() which
> presumably uses Socket.close() internally, judging by the log
> messages.
> 
> In fact, looking at the code for abort(), that sets the boolean
> aborted, but nothing seems to use the flag, as I could not find any
> references to the method isAborted().
> 
> Presumably the code in DefaultHttpRequestRetryHandler.retryRequest() -
> or perhaps DefaultRequestDirector.tryExecute() - ought to take that
> into account?
> 
> Is there perhaps other code that needs to check isAborted()?
> 

At the very least DefaultHttpRequestRetryHandler#retryRequest should
take it into account. 

Please raise a JIRA for this issue.

cheers

Oleg



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


Re: Should HC retry all SocketExceptions?

Posted by sebb <se...@gmail.com>.
On 30 August 2011 21:06, sebb <se...@gmail.com> wrote:
> The method DefaultHttpRequestRetryHandler.retryRequest currently
> retries IOExceptions which are not:
>
> InterruptedIOException
> UnknownHostException
> ConnectException
> SSLException
>
> However, this includes exceptions such as the following:
>
> org.apache.http.impl.client.DefaultHttpClient: I/O exception
> (java.net.SocketException) caught when processing request: socket
> closed
> org.apache.http.impl.client.DefaultHttpClient: Retrying request
>
> and
>
> org.apache.http.impl.client.DefaultHttpClient: I/O exception
> (java.net.BindException) caught when connecting to the target host:
> Address already in use: connect
> org.apache.http.impl.client.DefaultHttpClient: Retrying connect
>
> which seems wrong (but perhaps I am wrong).
>
> I discovered this because JMeter currently uses Socket.close() to
> interrupt an active sample. Probably there is a better way to do this.

Sorry, that's misleading - JMeter uses HttpUriRequest.abort() which
presumably uses Socket.close() internally, judging by the log
messages.

In fact, looking at the code for abort(), that sets the boolean
aborted, but nothing seems to use the flag, as I could not find any
references to the method isAborted().

Presumably the code in DefaultHttpRequestRetryHandler.retryRequest() -
or perhaps DefaultRequestDirector.tryExecute() - ought to take that
into account?

Is there perhaps other code that needs to check isAborted()?

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