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.1.0, 1.0.3, 1.0.2, 1.0.1, 1.0.0
Reporter: Trustin Lee
Priority: Critical
Fix For: 1.0.4, 1.1.1
>From Mladen Turk <[EMAIL PROTECTED]>:
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.