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

when client want to connect to server by binding wrong ip address,there is a bug.

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.7
    • Fix Version/s: 2.0.8
    • Component/s: Core
    • Labels:
      None
    • Environment:
      aix6.1

      Description

      look at below codes, when localAddress is not right of client machine,it will throw java.net.BindException.
      then, it will have no chance to do this : ch.socket().close()
      this problem is that the file handle will never be released.
      I have test in aix and the way of getting nums of file handle is:
      lsof -s |grep java

      source code
      mina2.0.7

      NioSocketConnector.java
          protected SocketChannel newHandle(SocketAddress localAddress) throws Exception {
              SocketChannel ch = SocketChannel.open();
      
              int receiveBufferSize = (getSessionConfig()).getReceiveBufferSize();
              if (receiveBufferSize > 65535) {
                  ch.socket().setReceiveBufferSize(receiveBufferSize);
              }
      
              if (localAddress != null) {
                  ch.socket().bind(localAddress);
              }
              ch.configureBlocking(false);
              return ch;
          }
      

        Issue Links

          Activity

          Hide
          elecharny Emmanuel Lecharny added a comment -

          Fixed with commit 9d7d823edacede56813674b94cba2ae65977426f.

          We now close teh channel when we get an IOException.

          Show
          elecharny Emmanuel Lecharny added a comment - Fixed with commit 9d7d823edacede56813674b94cba2ae65977426f. We now close teh channel when we get an IOException.

            People

            • Assignee:
              Unassigned
              Reporter:
              wallgreat wallgreat
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development