[
https://issues.apache.org/jira/browse/DIRMINA-804?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Emmanuel Lecharny updated DIRMINA-804:
--------------------------------------
Description:
Steps to reproduce:
1. Use below code.
{code}
NioDatagramAcceptor acceptor = new NioDatagramAcceptor();
acceptor.setHandler(new IoHandlerAdapter());
SocketAddress localAddress = new InetSocketAddress("localhost",9001);
acceptor.bind(localAddress);
acceptor.unbind(localAddress);
{code}
2. use debugger to step over here after unbind() call but before exiting the
process
3. use netstat to check current UDP sockets. you can find port 9001 not
released yet.
Possible solution: invoke selector.selectNow() after closing the channel.
{code}
@Override
protected void close(DatagramChannel handle) throws Exception {
SelectionKey key = handle.keyFor(selector);
if (key != null) {
key.cancel();
}
handle.disconnect();
handle.close();
selector.selectNow();
}
{code}
was:
Steps to reproduce:
1. Use below code.
NioDatagramAcceptor acceptor = new NioDatagramAcceptor();
acceptor.setHandler(new IoHandlerAdapter());
SocketAddress localAddress = new InetSocketAddress("localhost",9001);
acceptor.bind(localAddress);
acceptor.unbind(localAddress);
2. use debugger to step over here after unbind() call but before exiting the
process
3. use netstat to check current UDP sockets. you can find port 9001 not
released yet.
Possible solution: invoke selector.selectNow() after closing the channel.
@Override
protected void close(DatagramChannel handle) throws Exception {
SelectionKey key = handle.keyFor(selector);
if (key != null) {
key.cancel();
}
handle.disconnect();
handle.close();
selector.selectNow();
}
> NioDatagramAcceptor.unbind does not unbind cleanly
> --------------------------------------------------
>
> Key: DIRMINA-804
> URL: https://issues.apache.org/jira/browse/DIRMINA-804
> Project: MINA
> Issue Type: Bug
> Components: Transport
> Affects Versions: 2.0.0
> Environment: Windows 7
> Reporter: Zhou
> Fix For: 2.0.8
>
>
> Steps to reproduce:
> 1. Use below code.
> {code}
> NioDatagramAcceptor acceptor = new NioDatagramAcceptor();
> acceptor.setHandler(new IoHandlerAdapter());
> SocketAddress localAddress = new InetSocketAddress("localhost",9001);
> acceptor.bind(localAddress);
> acceptor.unbind(localAddress);
> {code}
> 2. use debugger to step over here after unbind() call but before exiting the
> process
> 3. use netstat to check current UDP sockets. you can find port 9001 not
> released yet.
> Possible solution: invoke selector.selectNow() after closing the channel.
> {code}
> @Override
> protected void close(DatagramChannel handle) throws Exception {
> SelectionKey key = handle.keyFor(selector);
> if (key != null) {
> key.cancel();
> }
>
> handle.disconnect();
> handle.close();
> selector.selectNow();
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)