-
Notifications
You must be signed in to change notification settings - Fork 259
Closed
Milestone
Description
in NioUdpClient.sendrecv method, when IOException happened,channel will be closed,so the os can reuse the udp port.
but, when execute "selector.wakeup();" , it may throw a InternalError which is a Throwable Error, not a IOException.
thus the channel will not be closed any more, it will occupy the udp port forever, when times on, there will no port can be used.
below is the code:
static CompletableFuture<byte[]> sendrecv(
// some other code here
try {
final Selector selector = selector();
channel = DatagramChannel.open();
channel.configureBlocking(false);
// some other code here
channel.connect(remote);
pendingTransactions.add(t);
registrationQueue.add(t);
selector.wakeup();
} catch (IOException e) {
if (channel != null) {
try {
channel.close();
} catch (IOException ioe) {
// ignore
}
}
f.completeExceptionally(e);
}
return f;
}
Metadata
Metadata
Assignees
Labels
No labels