Skip to content

Commit

Permalink
Do not close ServerChannel on IOException while accepting an incoming…
Browse files Browse the repository at this point in the history
… connection

.. so that we can recover from 'too many open files'

- Fixes netty#1578
  • Loading branch information
trustin committed Jul 16, 2013
1 parent 57eb531 commit dcf7896
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import io.netty.channel.Channel;
import io.netty.channel.ChannelConfig;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.ServerChannel;

import java.io.IOException;
import java.nio.channels.SelectableChannel;
Expand Down Expand Up @@ -91,7 +92,9 @@ public void read() {

if (exception != null) {
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);
Expand Down

0 comments on commit dcf7896

Please sign in to comment.