AprSocketAcceptor doesn't work and throws IOExceptions many times.
------------------------------------------------------------------

                 Key: DIRMINA-846
                 URL: https://issues.apache.org/jira/browse/DIRMINA-846
             Project: MINA
          Issue Type: Bug
          Components: Transport
    Affects Versions: 2.0.4
         Environment: Windows XP, Java 1.6.0_26, tcnative_1.dll 1.1.20
            Reporter: Alessandro Romussi


We use AprSocketAcceptor for a TCP Server instead of NioSocketAcceptor,
a client (NioSocketConnector) connects to the server and send a string, 
the AprIoProcessor continue throwing an excpetion and no string is received by 
the handler.
No problem with NioSocketAcceptor and same code.
The excpetion is
WARN  - 2011-08-04 12:37:53,835 - [  
AprIoProcessor-3][DefaultExceptionMonitor.java:  47]
Unexpected exception.
java.io.IOException: No error (code: 0)
        at 
org.apache.mina.transport.socket.apr.AprIoProcessor.throwException(AprIoProcessor.java:467)
        at 
org.apache.mina.transport.socket.apr.AprIoProcessor.select(AprIoProcessor.java:143)
        at 
org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1093)
        at 
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown 
Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

We have observed that if we change the method select(long timeout) of 
org.apache.mina.transport.socket.apr.AprIoProcessor at lines 177-183 and we use
       if (socket == wakeupSocket) {
                    synchronized (wakeupLock) {
                        Poll.remove(pollset, wakeupSocket);
                        toBeWakenUp = false;
                       wakeupCalled.set(true); // <-- this is the new line
                    }
                    continue;
                }

the problem is solved.


The code that create the IoAcceptor is very simple:

PrefixedStringCodecFactory pscf = new PrefixedStringCodecFactory(
                                Charset.forName("UTF-8"));
                pscf.setEncoderPrefixLength(4);
                pscf.setDecoderPrefixLength(4);
                IoAcceptor acceptor = new AprSocketAcceptor();
                acceptor.getFilterChain().addLast("codec", new 
ProtocolCodecFilter(pscf));
                acceptor.getFilterChain().addLast("executor", executorFilter);
                acceptor.setDefaultLocalAddress(new InetSocketAddress(port));
                acceptor.setHandler(ioHandler);



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to