1. MINA
  2. DIRMINA-889

MINA is lacking a set of exceptions to properly inform the user about what is going on


    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.4
    • Fix Version/s: 3.0.0-M1
    • Component/s: None
    • Labels:


      following scenario:

      A MINA powered server application is reading data from network, which is sent by any client. While server is getting data, the connection get's broken. The read() from server is interrupted and exceptionCaught() in IoHandler is called.

      Currently, my exceptionCaught() implementation looks like this:

      public void exceptionCaught(IoSession session, Throwable throwable) throws Exception {
      logger.error("exception Caught. session={}. Exception:\n {}", new Object[]

      {Utils.longToHexString(session.getId()), Utils.getStackTraceAsString(throwable)}

      logger.debug("Closing the session now! session={}", Utils.longToHexString(session.getId()));

      Problem is, that I don't know how to differentiate between "real and important exceptions", which need to be logged more prominent and exception which might occur because of a client has been disconnected correctly (broken network connection). if a connection get's broken, I just get a generic IOException:

      Feb 21, 2012 5:10:20 PM de.root1.simon.Dispatcher exceptionCaught
      Schwerwiegend: exception Caught. session=0x00000002. Exception:
      java.io.IOException: Die Verbindung wurde vom Kommunikationspartner zurückgesetzt
      at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
      at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
      at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:218)
      at sun.nio.ch.IOUtil.read(IOUtil.java:191)
      at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:359)
      at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:280)
      at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:44)
      at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:695)
      at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
      at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
      at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:68)
      at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1141)
      at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      at java.lang.Thread.run(Thread.java:722)

      There should be some MINA exceptions handling (f.i. in this special scenario a kihd of "UnexpectedlyClosedConnectionException" or so) this kind of problems, so that one can differentiate the exceptions in "exceptionCaught" to know what really happened somewhere deep in MINA.
      Alternatively, there could be some error-codes. But would really prefer the solution with the MINA exceptions ...


        No work has yet been logged on this issue.


          • Assignee:
            Julien Vermillard
            Alex C.
          • Votes:
            0 Vote for this issue
            2 Start watching this issue


            • Created: