2016-11-18 172 views
2

我们使用haproxy做负载均衡,并且netty服务器保持上升“java.io.IOException:由对等方重置的连接” 下面是异常堆栈:netty java.io.IOException:由RST导致的对等重置的连接,ACK

java.io.IOException: Connection reset by peer 
at sun.nio.ch.FileDispatcherImpl.read0(Native Method) 
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) 
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) 
at sun.nio.ch.IOUtil.read(IOUtil.java:192) 
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379) 
at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288) 
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1055) 
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:245) 
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:112) 
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:510) 
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:467) 
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:381) 
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:353) 
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:742) 
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) 
at java.lang.Thread.run(Thread.java:745) 

我使用tcpdump的转储网状服务器的网络数据,看看下面

enter image description here 10.125.137.11,10.125.137.13,10.125.137.14是hapxory服务器IP 似乎HAProxy的只需发送[RST,ACK]完成健康检查。因此,我想知道如果我必须在我的处理程序中处理这种情况(如检查异常是IOException,只是忽略它,因为日志充满了这个异常),或者它应该由netty它自己处理?

回答

0

如果HAProxy发送一个RST,那么它是预期的。如果您不在意,您可以通过覆盖exceptionCaught(...)方法来过滤掉ChannelHandler实现中的异常。

+0

我已经想过了,但是我担心如果我忽略IOException,也可能会忽略相同的实际错误 –

相关问题