Open NipunMalhotra-coder opened 1 day ago
@NipunMalhotra-coder You are using unsupported version, please update to a supported one.
@violetagg , are you referring to the SpringBoot version? Will 3.2.3 resolve this?
spring-boot-starter-parent 2.6.6 uses Reactor Netty 1.0.x which is out of OSS support
@violetagg : Thanks a lot for quick response :) can you please help with the minimum spring-boot-starter-parent version which will resolve this?
@NipunMalhotra-coder memory leaks can have different root cause because of that it is recommended to try the latest released version for both Spring and Reactor Netty
@violetagg : Sure. Will try with the latest version and validate.
Potential memory leak in spring boot application due to reactor netty.
Env details:
JDK: 11 Log level updated for netty spring:
netty: leak-detection: paranoid
Application Details> typeReference = new ParameterizedTypeReference<ServerSentEvent>() {
};
Getting data from downstream and consuming it in streams using webclient. WebClient.ResponseSpec response = webClient .build() .get() .uri(url) .retrieve() .bodyToFlux(typeReference) .onBackpressureBuffer(100) .take(63000); where typeReference is: ParameterizedTypeReference<ServerSentEvent
Also, in memory codec is set to 80MB in application.yml.
The response is of type: Flux<ServerSentEvent>, which is subscribed and data is sent via SSEEmitter.
PLEASE LET ME KNOW IN CASE ANY FURTHER INFO IS NEEDED
Error trace ResourceLeakDetector.reportTracedLeak:319 ERROR io.netty.util.ResourceLeakDetector - LEAK: ByteBuf.release() was not called before it's garbage-collected. See https://netty.io/wiki/reference-counted-objects.html for more information. Recent access records:
1:
2:
3:
4:
5:
6:
Created at: io.netty.buffer.PooledByteBufAllocator.newHeapBuffer(PooledByteBufAllocator.java:384) io.netty.buffer.AbstractByteBufAllocator.heapBuffer(AbstractByteBufAllocator.java:169) io.netty.buffer.AbstractByteBufAllocator.heapBuffer(AbstractByteBufAllocator.java:160) io.netty.handler.codec.compression.ZlibDecoder.prepareDecompressBuffer(ZlibDecoder.java:65) io.netty.handler.codec.compression.JdkZlibDecoder.decode(JdkZlibDecoder.java:235) io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510) io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:449) io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:343) io.netty.handler.codec.http.HttpContentDecoder.decode(HttpContentDecoder.java:264) io.netty.handler.codec.http.HttpContentDecoder.decodeContent(HttpContentDecoder.java:171) io.netty.handler.codec.http.HttpContentDecoder.decode(HttpContentDecoder.java:160) io.netty.handler.codec.http.HttpContentDecoder.decode(HttpContentDecoder.java:47) io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:327) io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:314) io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:435) io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279) io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800) io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480) io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) java.base/java.lang.Thread.run(Thread.java:829) : 14 leak records were discarded because they were duplicates : 77539 leak records were discarded because the leak record count is targeted to 4. Use system property io.netty.leakDetection.targetRecords to increase the limit.