At line 127 of spring-core/src/main/java/org/springframework/core/codec/StringDecoder.java at the main branch, you have
.doOnTerminate(chunks::releaseAndClear)
But chunks won't be released and cleared upon cancellation according to javadoc of reactor-core's reactor.core.publisher.Flux.doOnTerminate():
Add behavior (side-effect) triggered when the Flux terminates, either by completing successfully or failing with an error.
I suggest that you fix this potential memory leak by replacing doOnTerminate() by doFinally() because doFinally() Add behavior (side-effect) triggered after the Flux terminates for any reason, including cancellation.
Comment From: rstoyanchev
Thanks for the report. I've also added a test that proved the issue since existing tests were not catching it.
Comment From: yunjeffluo
thank you so much for fixing this issue quickly, we really appreciate it
On Tue, May 9, 2023 at 2:05 PM Rossen Stoyanchev @.***> wrote:
Thanks for the report. I've also added a test that proved the issue since existing tests were not catching it.
— Reply to this email directly, view it on GitHub https://github.com/spring-projects/spring-framework/issues/30299#issuecomment-1540741365, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOE6I3RQFOJN3DJYBTJEZO3XFKIOVANCNFSM6AAAAAAWV4THCM . You are receiving this because you authored the thread.Message ID: @.***>
-- Jeff Luo http://mymathworks.com