Hello,

It looks like there are some handlers not releasing buffers properly. This happens on a high load constantly and causes our services to run out of memory. Could you please have a look.

Its not straightforward to provide your with an example producing this issue.

Also, note that our web client is configured to consume buffers properly as far as I know (using retreive):

 webClient
            .get()
....
            .retrieve()
            .bodyToMono
....

Here are the output of the resource leak detector on a paranoid level.

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:      
io.netty.buffer.AdvancedLeakAwareByteBuf.order(AdvancedLeakAwareByteBuf.java:71)      
io.netty.buffer.CompositeByteBuf.newComponent(CompositeByteBuf.java:346)      
io.netty.buffer.CompositeByteBuf.addComponent0(CompositeByteBuf.java:287)      
io.netty.buffer.CompositeByteBuf.addComponent(CompositeByteBuf.java:265)      
io.netty.buffer.CompositeByteBuf.addComponent(CompositeByteBuf.java:222)      
io.netty.buffer.WrappedCompositeByteBuf.addComponent(WrappedCompositeByteBuf.java:544)      
io.netty.buffer.AdvancedLeakAwareCompositeByteBuf.addComponent(AdvancedLeakAwareCompositeByteBuf.java:921)      
org.springframework.core.io.buffer.NettyDataBufferFactory.join(NettyDataBufferFactory.java:111)      
org.springframework.core.io.buffer.DataBufferUtils.lambda$join$19(DataBufferUtils.java:584)      
reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:283)      
reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onNext(FluxFilterFuseable.java:337)      
reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816)      
reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:160)      
reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)      
reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)      
reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)      
reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:400)      
reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:419)      
reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:473)      
reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:703)      
reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:93)      
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:336)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308)      
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.handler.ssl.SslHandler.unwrap(SslHandler.java:1373)      
io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1236)      
io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1285)      
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:519)      
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:458)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280)      
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.AbstractEpollChannel$AbstractEpollUnsafe$1.run(AbstractEpollChannel.java:425)      
io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)      
io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)      
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)      
io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:403)      
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)      
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(Unknown Source)  
#2:      
io.netty.handler.codec.http.DefaultHttpContent.release(DefaultHttpContent.java:92)      
io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:90)      
reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:367)      
reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:404)      
reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:725)      
reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:93)      
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:336)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308)      
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.handler.ssl.SslHandler.unwrap(SslHandler.java:1373)      
io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1236)      
io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1285)      
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:519)      
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:458)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280)      
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.AbstractEpollChannel$AbstractEpollUnsafe$1.run(AbstractEpollChannel.java:425)      
io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)      
io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)      
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)      
io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:403)      
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)      
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(Unknown Source)  
#3:      
org.springframework.core.io.buffer.NettyDataBufferFactory.wrap(NettyDataBufferFactory.java:93)      
org.springframework.http.client.reactive.ReactorClientHttpResponse.lambda$getBody$1(ReactorClientHttpResponse.java:128)      
reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)      
reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200)      
reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)      
reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:364)      
reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:404)      
reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:725)      
reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:93)      
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:336)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308)      
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.handler.ssl.SslHandler.unwrap(SslHandler.java:1373)      
io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1236)      
io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1285)      
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:519)      
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:458)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280)      
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.AbstractEpollChannel$AbstractEpollUnsafe$1.run(AbstractEpollChannel.java:425)      
io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)      
io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)      
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)      
io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:403)      
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)      
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(Unknown Source)  
#4:      
org.springframework.http.client.reactive.ReactorClientHttpResponse.lambda$getBody$1(ReactorClientHttpResponse.java:127)      
reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)      
reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200)      
reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)      
reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:364)      
reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:404)      
reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:725)      
reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:93)      
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:336)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308)      
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.handler.ssl.SslHandler.unwrap(SslHandler.java:1373)      
io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1236)      
io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1285)      
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:519)      
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:458)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280)      
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.AbstractEpollChannel$AbstractEpollUnsafe$1.run(AbstractEpollChannel.java:425)      
io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)      
io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)      
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)      
io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:403)      
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)      
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(Unknown Source)  
#5:      
Hint: 'reactor.right.reactiveBridge' will handle the message from this point.      
io.netty.handler.codec.http.DefaultHttpContent.touch(DefaultHttpContent.java:86)      
io.netty.handler.codec.http.DefaultHttpContent.touch(DefaultHttpContent.java:25)      
io.netty.channel.DefaultChannelPipeline.touch(DefaultChannelPipeline.java:116)      
io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)      
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:336)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:308)      
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.handler.ssl.SslHandler.unwrap(SslHandler.java:1373)      
io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1236)      
io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1285)      
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:519)      
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:458)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280)      
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.AbstractEpollChannel$AbstractEpollUnsafe$1.run(AbstractEpollChannel.java:425)      
io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)      
io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)      
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)      
io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:403)      
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)      
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(Unknown Source)  
Created at:      
io.netty.buffer.SimpleLeakAwareByteBuf.unwrappedDerived(SimpleLeakAwareByteBuf.java:143)      
io.netty.buffer.SimpleLeakAwareByteBuf.readRetainedSlice(SimpleLeakAwareByteBuf.java:67)      
io.netty.buffer.AdvancedLeakAwareByteBuf.readRetainedSlice(AdvancedLeakAwareByteBuf.java:108)      
io.netty.handler.codec.http.HttpObjectDecoder.decode(HttpObjectDecoder.java:359)      
io.netty.handler.codec.http.HttpClientCodec$Decoder.decode(HttpClientCodec.java:239)      
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:519)      
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:458)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280)      
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.handler.ssl.SslHandler.unwrap(SslHandler.java:1373)      
io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1236)      
io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1285)      
io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:519)      
io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:458)      
io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:280)      
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.AbstractEpollChannel$AbstractEpollUnsafe$1.run(AbstractEpollChannel.java:425)      
io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)      
io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)      
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)      
io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:403)      
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)      
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(Unknown Source)"    


  • Reactor version(s) used: 3.4.23
  • Netty: 4.1.82.Final
  • Reactor Netty used: 1.0.23
  • JVM version: 17

Comment From: bclozel

You've not given much we can use to to understand where this can come from. Even if it really hard to reproduce, we would need to see how your project is actually using the WebClient and which Spring project versions are involved. Could you provide a sample application that we can git clone or download? A simple application performing multiple client calls against itself could reproduce the problem quite easily if the behavior is consistent in production. Thanks!

Comment From: mouadk

I am using Spring starter weblfux 2.7.4 (spring web flux: 5.3.23)

Here is how I configure my web client:

    private fun webClient(): WebClient {
        val exchangeStrategies = ExchangeStrategies.builder()
            .codecs { configurer -> configurer.defaultCodecs().maxInMemorySize(180 * 1024 * 1024) }
            .build()
        val provider = ConnectionProvider.builder("connection-pool")
            .lifo()
            .maxConnections(properties.connectionPool.maxConnections)
            .maxIdleTime(properties.connectionPool.maxIdleTime)
            .pendingAcquireMaxCount(-1)
            .build()
        val httpClient: HttpClient = HttpClient.create(provider)
        return WebClient.builder()
            .clientConnector(ReactorClientHttpConnector(httpClient))
            .baseUrl(properties.baseUrl)
            .exchangeStrategies(exchangeStrategies)
            .build()
    }

And here is how I use it:

 webClient
            .post()
            .header(...)
            .body(request)
            .retrieve()
            .bodyToMono(typeReference<T>())

I hope it helps.

Comment From: bclozel

I don't see anything wrong so far, so this might be more subtle than that. I'm afraid we'll need a concrete application as suggested in my previous comment.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.