[ 
https://issues.apache.org/jira/browse/DIRMINA-928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Lecharny updated DIRMINA-928:
--------------------------------------
    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 
{code}
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;
    }
{code}

  was:
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;
    }


> when client want to connect to server by binding wrong ip address,there is a 
> bug.
> ---------------------------------------------------------------------------------
>
>                 Key: DIRMINA-928
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-928
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.7
>         Environment: aix6.1
>            Reporter: wallgreat
>             Fix For: 2.0.8
>
>
> 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 
> {code}
> 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;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to