You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2012/07/09 14:27:34 UTC

[jira] [Resolved] (DIRMINA-846) AprSocketAcceptor doesn't work and throws IOExceptions many times.

     [ https://issues.apache.org/jira/browse/DIRMINA-846?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny resolved DIRMINA-846.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.5

Fixed with http://svn.apache.org/viewvc?rev=1359106&view=rev
                
> 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
>             Fix For: 2.0.5
>
>
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira