New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netty java.io.IOException: Connection reset by peer caused by RST,ACK #6029

Closed
craigwu9 opened this Issue Nov 16, 2016 · 5 comments

Comments

Projects
None yet
5 participants
@craigwu9
Copy link

craigwu9 commented Nov 16, 2016

We use haproxy to do load balance, and the netty server keep to rise "java.io.IOException: Connection reset by peer"
below is the exception stack:
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)

I use tcpdump to dump the network data of the netty server, and see below

image
10.125.137.11,10.125.137.13,10.125.137.14 are hapxory server ip
Seems haproxy just send [RST,ACK] to finish a health check.

So, I am wondering if I have to handle this situation in my handler(like check exception is IOException, just ignore it, because the log is full of this exception) , or it should be handled by netty it self?

@Scottmitch

This comment has been minimized.

Copy link
Member

Scottmitch commented Nov 18, 2016

If your peer sends a RST the TCP socket will be closed. You can ignore the exception at the application level but that doesn't change the kernel's behavior. Please identify why HAProxy is sending a RST and re-open this issue if you feel it can be attributed to a bug related to Netty.

@Scottmitch Scottmitch closed this Nov 18, 2016

@kiransunkari

This comment has been minimized.

Copy link

kiransunkari commented Jun 4, 2017

@craigwu9, iam also facing the same problem when I deployed in azure, how you solved the problem

@craigw

This comment has been minimized.

Copy link

craigw commented Jun 4, 2017

@kirunsunkari I think you meant to tag @craigwu9 not me.

@craigwu9

This comment has been minimized.

Copy link

craigwu9 commented Jun 22, 2017

@kiransunkari no good solution yet, just ignore it and log to a specific log file.

@MarsYoung

This comment has been minimized.

Copy link

MarsYoung commented Jul 31, 2018

how to ignore this log @kiransunkari

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment