0
votes

I'm using Netty3.5.9(jdk1.6.43) for my socket connections,most of the time ,it works well,but sometimes it shows:

java.io.IOException:A connection with a remote socket was reset by that socket

at sun.nio.ch.FileDispatcher.read0(Native Method)

at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:33)

at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:234)

at sun.nio.ch.IOUtil.read(IOUtil.java:201)

at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)

at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:321)

at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)

at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:896)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)

at java.lang.Thread.run(Thread.java:735)

2013-7-2 8:54:18 org.jboss.netty.channel.SimpleChannelUpstreamHandler null WARNING: EXCEPTION, please implement cfca.xfraud.collector.system.sockettype.netty.NettyAnalyzerHandler.exceptionCaught() for proper handling.

which my exceptionCaught() method is:

public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {

    log.error("", e.getCause());
    super.exceptionCaught(ctx, e);

}

Though the IOException shows sometimes,but the whole application seems has no any bad influence and stills works well,so what's the real problem,and what should I change the code to prevent the exception.

1
Does it really say "java.io.IOException:A connection with a remote socket was reset by that socket"? or does it say "connection reset by peer"? - user207421
it really says "java.io.IOException:A connection with a remote socket was reset by that socket",I am quite sure. - user1793814

1 Answers

1
votes

This is nothing to be concerned about ... It means that the remote peer closed the connection and netty detect it when the read is done. So you are safe to ignore the exception.