You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Trustin Lee (JIRA)" <ji...@apache.org> on 2007/05/02 13:08:15 UTC

[jira] Reopened: (DIRMINA-374) ArrayIndexOutOfBoundException in SocketAcceptor and SocketConnector

     [ https://issues.apache.org/jira/browse/DIRMINA-374?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Trustin Lee reopened DIRMINA-374:
---------------------------------


SocketConnector needs the same fix, and the fix was not applied to the trunk, which has the same problem.

> ArrayIndexOutOfBoundException in SocketAcceptor and SocketConnector
> -------------------------------------------------------------------
>
>                 Key: DIRMINA-374
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-374
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.1.0
>            Reporter: Trustin Lee
>            Priority: Critical
>             Fix For: 1.0.4, 1.1.1
>
>
> From Mladen Turk <mt...@apache.org>:
> Hi,
> Here is the patch that fixes the SocketAcceptor.nextProcessor()
> The problem is that round robin distributor is integer and
> if you set the number of processors to > 1, after MAX_INTEGER
> requests (yes I know I tested that many :) it starts throwing
> something like:
> java.lang.ArrayIndexOutOfBoundsException: -3
> The reason?
> -value % 1 is always 0|1
> -value % 2 is always 0|-1
> Anyhow, enough math, here is the patch.
> Regards,
> Mladen.
> Index: SocketAcceptor.java
> ===================================================================
> --- SocketAcceptor.java (revision 533579)
> +++ SocketAcceptor.java (working copy)
> @@ -422,7 +422,11 @@
>     private SocketIoProcessor nextProcessor()
>     {
> -        return ioProcessors[processorDistributor++ % processorCount];
> +        if ( processorDistributor++ < 0 )
> +        {
> +            processorDistributor = 0;
> +        }
> +        return ioProcessors[processorDistributor % processorCount];
>     }
>     private void registerNew()

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.