zio-http icon indicating copy to clipboard operation
zio-http copied to clipboard

Emit java.io.IOException: Connection reset by peer

Open changzhiwin opened this issue 3 years ago • 2 comments

Describe the bug The app logic is running ok, but emit Exception, maybe not handle Netty suitable.

ENV OS: macOS Big Sur 11.7.1 zio-http: publishLocal the current master

Additional context [error] 十一月 09, 2022 11:12:05 上午 io.netty.channel.DefaultChannelPipeline onUnhandledInboundException [error] 警告: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception. [error] java.io.IOException: Connection reset by peer [error] at sun.nio.ch.FileDispatcherImpl.read0(Native Method) [error] at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) [error] at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) [error] at sun.nio.ch.IOUtil.read(IOUtil.java:192) [error] at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) [error] at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:258) [error] at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132) [error] at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357) [error] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151) [error] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) [error] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) [error] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) [error] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) [error] at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) [error] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [error] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [error] at java.lang.Thread.run(Thread.java:748)

changzhiwin avatar Nov 09 '22 03:11 changzhiwin

Hi @changzhiwin, do you have a reproducer for this?

vigoo avatar Jan 21 '23 12:01 vigoo

Can't reproduce it but I've encountered the same error when kubernetes probes the app with a low timeout. It's a Connection reset by peer type of error so it should connected with the client closing the connection before receiving the response. I've tried to reproduce it with a sleep and calling with a lower timeout but it does not trigger it. Maybe it has to happen while the response is being sent.

oker1 avatar Jul 11 '23 06:07 oker1