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

infinity loop in AbstractPollingIoProcessor.Processor.run if connection is closed

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.1
    • 2.0.2
    • Core
    • None

    Description

      While making some stress tests of my application, that uses mina on client and server sides, I discovered that sometimes mina leaves some threads to work after session.close(false) and connector.dispose(false).

      ExceptionMonitor says that there is an exception

      java.nio.channels.ClosedSelectorException
      at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:66)
      at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:80)
      at org.apache.mina.transport.socket.nio.NioProcessor.select(NioProcessor.java:70)
      at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1067)
      at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)

      Then I tried to dig deeper. And I've found the loop in AbstractPollingIoProcessor.Processor.run

      for (; {
      try

      { int selected = select(SELECT_TIMEOUT); //... }

      catch (Throwable t)

      { ExceptionMonitor.getInstance().exceptionCaught(t); //... }

      }

      This loop is definitely infinite, if select throws ClosedSelectorException.

      So, ClosedSelectorException have to be processed with another way.

      Attachments

        Activity

          People

            Unassigned Unassigned
            ertong Ertong
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: