Do not close ServerChannel on IOException while accepting an incoming connection
.. so that we can recover from 'too many open files' - Fixes #1578
This commit is contained in:
parent
57eb531eb8
commit
dcf7896172
@ -18,6 +18,7 @@ package io.netty.channel.nio;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelConfig;
|
import io.netty.channel.ChannelConfig;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
|
import io.netty.channel.ServerChannel;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.channels.SelectableChannel;
|
import java.nio.channels.SelectableChannel;
|
||||||
@ -91,7 +92,9 @@ public abstract class AbstractNioMessageChannel extends AbstractNioChannel {
|
|||||||
|
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
if (exception instanceof IOException) {
|
if (exception instanceof IOException) {
|
||||||
closed = true;
|
// ServerChannel should not be closed even on IOException because it can often continue
|
||||||
|
// accepting incoming connections. (e.g. too many open files)
|
||||||
|
closed = !(AbstractNioMessageChannel.this instanceof ServerChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline.fireExceptionCaught(exception);
|
pipeline.fireExceptionCaught(exception);
|
||||||
|
Loading…
Reference in New Issue
Block a user