mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-23 22:59:03 +00:00
When a multipart subscriber cancels while MultipartParser has already emitted body tokens beyond the downstream demand, those tokens are held in the Flux.create sink queue (and in downstream operator queues such as windowUntil). On cancellation, Reactor discards the queued tokens, but BodyToken is not a DataBuffer, so the buffers inside the discarded tokens are never released and Netty reports "LEAK: ByteBuf.release() was not called before it's garbage-collected". Register a doOnDiscard hook for BodyToken in MultipartParser.parse() so that a discarded body token releases its buffer, both in the sink queue and in any downstream operator queue that supports discarding. Closes gh-37115 Signed-off-by: Hyunsik Kang <cj848@hanmail.net>