这是 Netty 从封闭通道读取的示例吗?
Is this an example of Netty reading from a closed channel?
我正在通过大量并发 GET
请求对 Netty-based 项目进行负载测试。
在重负载下,我得到了很多这样的例子:
WARNING: 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.
java.io.IOException: Connection reset by peer
at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358)
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:247)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1147)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
[snip]
我知道错误消息告诉我管道的最后一个元素没有处理这个 IOException
。我有兴趣首先防止错误。
我的推断是否正确,这意味着无论出于何种原因,Netty 正试图从一个封闭的通道中 读取?这是否意味着当 Netty 试图从中读取时,我的负载测试工具已经关闭了它写入请求 headers 等内容的套接字,因此 Netty 抛出了这个异常?
鉴于我只在重负载下看到这一点,这是否意味着(例如)我的事件循环太忙而无法在负载测试工具 "calls" 时实际 "answer the phone"?如果是这样,它为什么要尝试从通道读取?
在实践中没有办法不发生这种情况,因为它只是告诉您远程对等点没有正常关闭连接。如果您不感兴趣,您应该忽略异常并拆解 Channel
.
我正在通过大量并发 GET
请求对 Netty-based 项目进行负载测试。
在重负载下,我得到了很多这样的例子:
WARNING: 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.
java.io.IOException: Connection reset by peer
at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:358)
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:247)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1147)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:347)
[snip]
我知道错误消息告诉我管道的最后一个元素没有处理这个 IOException
。我有兴趣首先防止错误。
我的推断是否正确,这意味着无论出于何种原因,Netty 正试图从一个封闭的通道中 读取?这是否意味着当 Netty 试图从中读取时,我的负载测试工具已经关闭了它写入请求 headers 等内容的套接字,因此 Netty 抛出了这个异常?
鉴于我只在重负载下看到这一点,这是否意味着(例如)我的事件循环太忙而无法在负载测试工具 "calls" 时实际 "answer the phone"?如果是这样,它为什么要尝试从通道读取?
在实践中没有办法不发生这种情况,因为它只是告诉您远程对等点没有正常关闭连接。如果您不感兴趣,您应该忽略异常并拆解 Channel
.