You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by James Xu <ja...@icontrol.com> on 2015/06/15 23:53:02 UTC

Issue and questions related SSLHandler

Dear Mina Developer,

We are using Mina(1.1.8) and Openfire for our project. Recently with heavy load to the server, we got following exception in server side:

java.lang.IllegalArgumentException
at java.nio.Buffer.position(Buffer.java:236)
at org.apache.mina.filter.support.SSLHandler.messageReceived(SSLHandler.java:313)
at org.apache.mina.filter.SSLFilter.messageReceived(SSLFilter.java:392)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
at org.apache.mina.common.support.AbstractIoFilterChain$HeadFilter.messageReceived(AbstractIoFilterChain.java:499)
at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
at org.apache.mina.common.support.AbstractIoFilterChain.fireMessageReceived(AbstractIoFilterChain.java:293)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.java:228)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcessor.java:198)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProcessor.java:45)
at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProcessor.java:485)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
>

When I checked the source code, I think it is a bug.

Here is the source code of 1.1.7/1.18,


if (isInboundDone()) {

            // Rewind the MINA buffer if not all data is processed and inbound is finished.

            buf.position(buf.position() - inNetBuffer.position());

            inNetBuffer.clear();

        }


This means sometimes buf.position() - inNetBuffer.position() can be negative, then the correct code should be:


if (isInboundDone()) {

            // Rewind the MINA buffer if not all data is processed and inbound is finished.

    if (inNetBuffer.position() <= buf.position()) {

             buf.position(buf.position() - inNetBuffer.position());

    }

            inNetBuffer.clear();

        }


Please confirm!


Thanks a lot!


James




Re: Issue and questions related SSLHandler

Posted by James Xu <ja...@icontrol.com>.
Thanks Emmanuel for your quick reply!

Yes, we know the 1.1.8 has not been supported for long time, I just want
you confirm my thought.

BTW, I checked the new 2.0.9 version, it has the similar code and I think
it has the same potential issues.

Here is the 2.0.9's code:

if (isInboundDone()) {
            // Rewind the MINA buffer if not all data is processed and
inbound
            // is finished.
            int inNetBufferPosition = inNetBuffer == null ? 0 :
inNetBuffer.position();
            buf.position(buf.position() - inNetBufferPosition);

            if (inNetBuffer != null) {
                inNetBuffer.free();
                inNetBuffer = null;
            }
        }

In some case, the 'inNetBufferPosition' can be larger than buf.position().


Thanks,
James




On 6/15/15, 5:18 PM, "Emmanuel Lécharny" <el...@gmail.com> wrote:

>Le 15/06/15 23:53, James Xu a écrit :
>> Dear Mina Developer,
>>
>> We are using Mina(1.1.8) and Openfire for our project. Recently with
>>heavy load to the server, we got following exception in server side:
>
>I'm sorry, but MINA 1.1 is not maintained anymore for more than 5 years
>now.
>
>I would suggest you to switch to MINA 2.0.9, or to eventually fix the
>code and build your own jar.
>


Re: Issue and questions related SSLHandler

Posted by Emmanuel Lécharny <el...@gmail.com>.
Le 15/06/15 23:53, James Xu a écrit :
> Dear Mina Developer,
>
> We are using Mina(1.1.8) and Openfire for our project. Recently with heavy load to the server, we got following exception in server side:

I'm sorry, but MINA 1.1 is not maintained anymore for more than 5 years now.

I would suggest you to switch to MINA 2.0.9, or to eventually fix the
code and build your own jar.