Affects: \


  1. We new to Spring webflux with netty . We have built application with spring webflux ,but heap memory is not coming down ,it always incremental . We have applied all GC algorithms ,and we verified code also everything looks good . We observed on call subscription() method ,webflux is creating threads in back end and that memory is not visible to JVM .Can any please help why this issue with webflx.
  2. We have applied the property of io.netty.allocator.useCacheForAllThreads=false ,But no use
  3. Our system configurations spring-boot-starter-webflux :2.3.0 M3 ,r2dbc-mssql 0.8.3 (using sql server in back end),apache kafka .

Please help us to find out the root cause for the problem

Comment From: rstoyanchev

spring-boot-starter-webflux :2.3.0 M3

Is this really a pre-release milestone you're using? I would start by switching to a production release and to the most recent maintenance version which in the 2.3.x branch is 2.3.7 currently.

Beyond that, this is an issue tracker for reporting issues and for that we need more detail.

Comment From: dineshkumardidugu

Okay i will try with higher version spring-boot-starter-webflux and let you know

Comment From: dineshkumardidugu

Meanwhile can you please let us know ,what are all the details you need

Comment From: dineshkumardidugu

spring-boot-starter-webflux :2.3.0 M3

Is this really a pre-release milestone you're using? I would start by switching to a production release and to the most recent maintenance version which in the 2.3.x branch is 2.3.7 currently.

Beyond that, this is an issue tracker for reporting issues and for that we need more detail.

---- Hi I used the latest version of spring webflux 2.4.1 . But I could not see any heap memory drop at at all . Initially it took 1250 MB (On consuming/producing) to kafka ,But after the completion of operation also ,heap memory not reclaimed . even application is idle now ,not doing any operation. But there is not memory drop . I can see number of alive threads are 78 , due to code of conduct violations I am not able to post image here.

Summary :

Initial memory took :250 to 1280 MB

After operation : memory remains at 1250 MB,not reclaiming

No of live threads :78 and Daemon threads :28

Please help me in solving the issue. and let me know what are details you need from my end

Comment From: dineshkumardidugu

Getting the below issue after upgrading jar also

io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1 at io.netty.util.internal.ReferenceCountUpdater.toLiveRealRefCnt(ReferenceCountUpdater.java:74) at io.netty.util.internal.ReferenceCountUpdater.release(ReferenceCountUpdater.java:138) at io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:100)

java.lang.OutOfMemoryError: GC overhead limit exceeded at java.util.Arrays.copyOf(Arrays.java:3332) at java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124) at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:649)

Comment From: rstoyanchev

Can you isolate it in a reproducible sample? If not please describe what the application is doing.

Comment From: dineshkumardidugu

Application is doing some data base operations and producing data to kafka topic using Avro Schema.

Data base operations : 1. Inserting/Updating the tables . 2. Fetching the updated/inserted rows as DTO 3. Making Avro object for each DTO and posting to kafka

My observation is when we invoke .subscribe method some event treads are creating and those are not getting eligible for JVM to clean up.

Comment From: dineshkumardidugu

Hi Any idea/help for me to come out of this memory issue of Spring webflux

Comment From: dineshkumardidugu

Hi @rstoyanchev can you please help me to solve the issue.

Comment From: rstoyanchev

@dineshkumardidugu it's not possible to pinpoint a memory leak from a high level description like that. To increase the chances of solving this, do some investigation on your own first. For example check what objects are being leaked with a JVM profiler. Try changing properties like the one you mentioned above and whether it make a difference.

If the leak is related to Netty ByteBufs then we would need to know how buffers are handled in your application. For that we'd have to see specific code. The best would be if you can create a reproducible sample.

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.

Comment From: amolksagar

hi @dineshkumardidugu Did you find a solution for this issue?