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

Emmanuel Lecharny commented on DIRMINA-1083:
--------------------------------------------

Reads and writes are concurrent: we want to have the opportunity to abandon an 
operation. We have an executor in the chain for that purpose:

{noformat}
...
            if ( transport.isSSLEnabled() )
            {
                chain = LdapsInitializer.init( this, ( TcpTransport ) transport 
);
            }
            else
            {
                chain = new DefaultIoFilterChainBuilder();
            }

            // Inject the codec into the chain
            ( ( DefaultIoFilterChainBuilder ) chain ).addLast( "codec", new 
ProtocolCodecFilter( this
                .getProtocolCodecFactory() ) );

            // Now inject an ExecutorFilter for the write operations
            // We use the same number of thread than the number of IoProcessor
            // (NOTE : this has to be double checked)
            ( ( DefaultIoFilterChainBuilder ) chain ).addLast( "executor", new 
ExecutorFilter(
                new UnorderedThreadPoolExecutor( transport.getNbThreads() ), 
IoEventType.MESSAGE_RECEIVED ) );
...
{noformat}

And yes, that means we may have a concurrency issue if we inject a 
{{SslFilter}} in the chain while a message is getting written back to the 
client. In this case, such a message may 'collide' with the handshake messages.

What I don't get is why it was working in {{2.0.16}} and not anymore...


> Regression on SSL connection
> ----------------------------
>
>                 Key: DIRMINA-1083
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-1083
>             Project: MINA
>          Issue Type: Bug
>    Affects Versions: 2.0.17
>            Reporter: Emmanuel Lecharny
>            Priority: Major
>             Fix For: 2.0.18
>
>
> We are using MINA in Apache Directory. After having moved to MINA 2.0.17, we 
> now have failures like :
> {noformat}
> Running org.apache.directory.shared.client.api.LdapSSLConnectionTest
> java.io.IOException: Broken pipe
>     at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
>     at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
>     at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93)
>     at sun.nio.ch.IOUtil.write(IOUtil.java:65)
>     at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471)
>     at 
> org.apache.mina.transport.socket.nio.NioProcessor.write(NioProcessor.java:384)
>     at 
> org.apache.mina.transport.socket.nio.NioProcessor.write(NioProcessor.java:47)
>     at 
> org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.writeBuffer(AbstractPollingIoProcessor.java:1107)
>     at 
> org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.flushNow(AbstractPollingIoProcessor.java:994)
>     at 
> org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.flush(AbstractPollingIoProcessor.java:921)
>     at 
> org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:688)
>     at 
> org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>     at java.lang.Thread.run(Thread.java:748)
> {noformat}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to