ktor icon indicating copy to clipboard operation
ktor copied to clipboard

Netty engine still print annoying exceptions

Open kobe2000 opened this issue 5 years ago • 5 comments

Ktor Version

1.1.3

Ktor Engine Used(client or server and name)

Netty - Firefox

JVM Version, Operating System and Relevant Context

Windows10 JDK8

Feedback

When I use Firefox to access web site build by ktor, exceptions are often printed in server logs as following:

2019-03-20 14:35:59.083 [nettyWorkerPool-3-2] DEBUG Application - I/O operation failed
java.io.IOException: 你的主机中的软件中止了一个已建立的连接。
	at sun.nio.ch.SocketDispatcher.read0(Native Method)
	at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
	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:380)
	at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288)
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1108)
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:345)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:148)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)

kobe2000 avatar Mar 20 '19 06:03 kobe2000

Got the same issue, here in mac OS or Docker environment with JDK 1.8. We have tried bridging with log4j2 but Netty completely ignore this. Netty only works with slf4j implementations like Logback, we checked on the Netty Github but cannot find solution.

If you have any idea for how to redirect and control Netty's logging output it would be so helpful.

Thanks :)

Akhu avatar May 20 '19 12:05 Akhu

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

oleg-larshin avatar Aug 10 '20 15:08 oleg-larshin

Could you please explain what exact problem do you have with those messages?

Stexxe avatar Jun 28 '21 14:06 Stexxe

Could you please explain what exact problem do you have with those messages?

In my opinion, the web server should ignore data outgoing IO exceptions, or log at TRACE level, like Tomcat etc.

kobe2000 avatar Jul 01 '21 06:07 kobe2000