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

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

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.4
    • 3.0.0-DEAD
    • None
    • None

    Description

      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:


      @Override
      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()));
      session.close(true);
      }


      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 ...

      Attachments

        Activity

          People

            vrm Julien Vermillard
            alex0801 Alex C.
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: