You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by Daniel Perry <d....@netcase.co.uk> on 2005/09/19 11:12:57 UTC

ArrayIndexOutOfBoundsException on decreasing maxRetries

Due to problems with our DNS servers, i shortened the times of outgoing
retries to 1 hour, and bumped up the maxRetries to 50.

Anyway, the DNS servers are sorted... so i put the config back.  Everything
seemed happy... until monday morning.

60GB of log files later... and a full hard disk...  duh! millions of
exceptions (see below for example).

Looking at the code, i cant see where it checks if it's hit the maximum
delay times.  Also, i cant see an obvious way to check this on loading the
message.

Can anyone who know the remotedelivery code well enough comment if the
folloing would work:
replace

    private long getNextDelay (int retry_count) {
            return delayTimes[retry_count-1];
    }

with

    private long getNextDelay (int retry_count) {
        try {
            return delayTimes[retry_count-1];
        }
        catch (ArrayIndexOutOfBoundsException ex){
            return 0;
        }
    }

ie, if outside of defined delay times, next delay time is 0, so process now!

Will it then realise that this is outside of the maximum retries and bounce
it?

Daniel.


19/09/05 09:30:25 INFO  James.Mailet: RemoteDelivery: Exception caught in
Remote
Delivery.run()
java.lang.ArrayIndexOutOfBoundsException: 28
        at
org.apache.james.transport.mailets.RemoteDelivery.getNextDelay(Remote
Delivery.java:981)
        at
org.apache.james.transport.mailets.RemoteDelivery.access$000(RemoteDe
livery.java:93)
        at
org.apache.james.transport.mailets.RemoteDelivery$MultipleDelayFilter
.accept(RemoteDelivery.java:155)
        at
org.apache.james.mailrepository.AvalonSpoolRepository.accept(AvalonSp
oolRepository.java:156)
        at
org.apache.james.transport.mailets.RemoteDelivery.run(RemoteDelivery.
java:901)
        at java.lang.Thread.run(Thread.java:534)



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


Re: ArrayIndexOutOfBoundsException on decreasing maxRetries

Posted by Serge Knystautas <sk...@gmail.com>.
On 9/19/05, Stefano Bagnara <ap...@bago.org> wrote:
> Yes. I'm not sure wether it would be better to return 0 or
> "delayTimes[delayTimes.length-1]". This only happens when you decrease the
> maxRetries.
> 
> The check for maxRetry is in the failMessage method:
> --
> int retries = Integer.parseInt(mail.getErrorMessage());
> if (retries < maxRetries) {
> --


I would just return 0.  I figure if you're removing max retries,
you're hoping to clear those messages as fast as possible.  Probably
not a big deal though.

-- 
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

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


Re: ArrayIndexOutOfBoundsException on decreasing maxRetries

Posted by Stefano Bagnara <ap...@bago.org>.
> Can anyone who know the remotedelivery code well enough 
> comment if the folloing would work:
> replace
> 
>     private long getNextDelay (int retry_count) {
>             return delayTimes[retry_count-1];
>     }
> 
> with
> 
>     private long getNextDelay (int retry_count) {
>         try {
>             return delayTimes[retry_count-1];
>         }
>         catch (ArrayIndexOutOfBoundsException ex){
>             return 0;
>         }
>     }
> 
> ie, if outside of defined delay times, next delay time is 0, 
> so process now!
> 
> Will it then realise that this is outside of the maximum 
> retries and bounce it?
> 
> Daniel.

Yes. I'm not sure wether it would be better to return 0 or
"delayTimes[delayTimes.length-1]". This only happens when you decrease the
maxRetries.
 
The check for maxRetry is in the failMessage method:
--
int retries = Integer.parseInt(mail.getErrorMessage());
if (retries < maxRetries) { 
--

Stefano


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