[ 
https://issues.apache.org/jira/browse/DIRMINA-542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12576906#action_12576906
 ] 

Trustin Lee commented on DIRMINA-542:
-------------------------------------

I found that the test passes with the byte code generated by Eclipse Java 
Compiler but fails with SUN Java Compiler.  CircularQueueTest fails randomly.  
We cannot say that it's a concurrency issue because the test runs in a single 
thread.  It looks definitely like a JVM or compiler bug - probably SUN VM 
doesn't like the code SUN Java Compiler produced or the byte code that SUN Java 
Compiler produced is wrong.

Changing one field in CircularQueue to be volatile works around the problem, 
but I didn't figure out why exactly it fixes the problem - SUN JVM might be 
optimizing CircularQueue in a wrong way and the volatile field might be 
preventing bad optimization.

> ArrayIndexOutOfBoundsException in CircularQueue.shrinkIfNeeded()
> ----------------------------------------------------------------
>
>                 Key: DIRMINA-542
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-542
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M1
>            Reporter: Trustin Lee
>            Assignee: Trustin Lee
>            Priority: Critical
>             Fix For: 2.0.0-M2
>
>
> ArrayIndexOutOfBoundsException is raised by CircularQueue.shrinkIfNeeded() 
> when the size of the queue is 0:
> java.lang.ArrayIndexOutOfBoundsException
> at org.apache.mina.util.CircularQueue.shrinkIfNeeded(CircularQueue.java:233)
> at org.apache.mina.util.CircularQueue.poll(CircularQueue.java:108)
> at 
> org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:375)
> at 
> org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:187)
> at 
> org.apache.mina.common.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:401)
> at 
> org.apache.mina.common.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:38)
> at 
> org.apache.mina.common.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:820)
> at 
> org.apache.mina.common.DefaultIoFilterChain$HeadFilter.messageReceived(DefaultIoFilterChain.java:604)
> at 
> org.apache.mina.common.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:401)
> at 
> org.apache.mina.common.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:395)
> at 
> org.apache.mina.common.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:425)
> at 
> org.apache.mina.common.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:387)
> at 
> org.apache.mina.common.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:379)
> at 
> org.apache.mina.common.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:43)
> at 
> org.apache.mina.common.AbstractPollingIoProcessor$Worker.run(AbstractPollingIoProcessor.java:676)
> at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
> at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
> at java.lang.Thread.run(Thread.java:619)

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

Reply via email to