例外:使用 Spring Client 对 Spring 中的 http-epoll-1 线程进行泄漏检测

Posted

技术标签:

【中文标题】例外:使用 Spring Client 对 Spring 中的 http-epoll-1 线程进行泄漏检测【英文标题】:Exception: Leak detection on http-epoll-1 thread in Spring with Spring Client 【发布时间】:2020-04-09 17:42:01 【问题描述】:

我在 Spring 应用程序中遇到了以下异常。 我使用 Spring-boot-starter 2.2.1 和 spring-boot-starer-reactor-netty 2.2.1。 (里面有 Reactory netty 0.9.1。)

我在我的应用程序中使用 spring-boot-admin-starter-client 2.2.0。

它不是按顺序抛出的,而且我看不到出现的任何模式。我刚刚将我的应用程序作为 unix 服务启动,一段时间后它抛出了。我的想法是关于 Spring 管理员和客户端,但我将它们升级到最新但仍然存在异常。

你能给我任何建议吗?为什么会抛出?

这个异常发生在线程or-http-epoll-1上:

2019-12-12 17:24:46.756+0100 ERROR 15674 --- [or-http-epoll-1] i.n.u.ResourceLeakDetector

在这个线程上,之前一切似乎都很好:


2019-12-12 17:23:16.763+0100 DEBUG 15674 --- [or-http-epoll-1] r.n.h.s.HttpServer : [id: 0x967afa3f, L:/127.0.1.1:8080 - R:/127.0.0.1:54646] Handler is being applied: org.springframework.http.server.reactive.ReactorHttpHandlerAdapter@33681b9d

2019-12-12 17:23:16.763+0100 DEBUG 15674 --- [or-http-epoll-1] o.s.w.s.a.HttpWebHandlerAdapter : [967afa3f] HTTP GET "/actuator/health"

2019-12-12 17:23:16.764+0100 DEBUG 15674 --- [or-http-epoll-1] .b.a.e.w.r.WebFluxEndpointHandlerMapping : [967afa3f] Mapped to org.springframework.boot.actuate.endpoint.web.reactive.AbstractWebFluxEndpointHandlerMapping$ReadOperationHandler@6de54b40

2019-12-12 17:23:17.768+0100 DEBUG 15674 --- [or-http-epoll-1] r.n.h.s.HttpServerOperations : [id: 0x967afa3f, L:/127.0.1.1:8080 - R:/127.0.0.1:54646] Decreasing pending responses, now 0

2019-12-12 17:23:17.768+0100 DEBUG 15674 --- [or-http-epoll-1] o.s.w.s.a.HttpWebHandlerAdapter : [967afa3f] Completed 200 OK

2019-12-12 17:23:17.768+0100 DEBUG 15674 --- [or-http-epoll-1] r.n.h.s.HttpServerOperations : [id: 0x967afa3f, L:/127.0.1.1:8080 - R:/127.0.0.1:54646] Last HTTP response frame

2019-12-12 17:23:17.768+0100 DEBUG 15674 --- [or-http-epoll-1] r.n.h.s.HttpServerOperations : [id: 0x967afa3f, L:/127.0.1.1:8080 - R:/127.0.0.1:54646] Last HTTP packet was sent, terminating the channel

2019-12-12 17:24:17.959+0100 DEBUG 15674 --- [or-http-epoll-1] r.n.h.s.HttpServerOperations : [id: 0x967afa3f, L:/127.0.1.1:8080 - R:/127.0.0.1:54646] Decreasing pending responses, now 0

2019-12-12 17:24:17.959+0100 DEBUG 15674 --- [or-http-epoll-1] r.n.h.s.HttpServerOperations : [id: 0x967afa3f, L:/127.0.1.1:8080 - R:/127.0.0.1:54646] Last HTTP packet was sent, terminating the channel

2019-12-12 17:24:46.756+0100 ERROR 15674 --- [or-http-epoll-1] i.n.u.ResourceLeakDetector : LEAK: ByteBuf.release() was not called before it's garbage-collected. See https://netty.i o/wiki/reference-counted-objects.html for more information. 
Recent access records: 
Created at:
    #011io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:349)
    #011io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:187)
    #011io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:178)
    #011io.netty.buffer.AbstractByteBufAllocator.buffer(AbstractByteBufAllocator.java:115)
    #011io.netty.buffer.ByteBufUtil.readBytes(ByteBufUtil.java:445) #011io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder.decode(WebSocket08FrameDecoder.java:314)
    #011io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:503)
    #011io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:442)
    #011io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:281)
    #011io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
    #011io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
    #011io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352)
    #011io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422)
    #011io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374)
    #011io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360)
    #011io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931)
    #011io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:792)
    #011io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:502)
    #011io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407) #011io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050)
    #011io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    #011io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    #011java.lang.Thread.run(Thread.java:748)

【问题讨论】:

为了便于阅读,考虑将日志输出/异常放在一个块中,例如使用 ``` stuff here ``。 编辑和sry。 【参考方案1】:

解决方案:我找到了一个 message.getPayload() 没有发布的内容,我在那里写了,问题不再发生。

【讨论】:

以上是关于例外:使用 Spring Client 对 Spring 中的 http-epoll-1 线程进行泄漏检测的主要内容,如果未能解决你的问题,请参考以下文章

HBase例外

spring的发音春天该怎么发音

在 spring-boot 中使用 web-client 解析 text/html 对 xml 的响应

spring是啥意思

Nacos——微服务下的服务注册

Spring AOP:Exception encountered during context initialization - cancelling refresh attempt: org.spr