Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-846

AprSocketAcceptor doesn't work and throws IOExceptions many times.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.4
    • 2.0.5
    • Transport
    • None
    • Windows XP, Java 1.6.0_26, tcnative_1.dll 1.1.20

    Description

      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);

      Attachments

        Activity

          People

            Unassigned Unassigned
            arom Alessandro Romussi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: