Skip to content

cache body to new attr avoid direct memory leak - #2483

Closed
WEIZIBIN wants to merge 2 commits into
spring-cloud:mainfrom
WEIZIBIN:bugfix_cache_request_body_buf_release
Closed

WEIZIBIN wants to merge 2 commits into
spring-cloud:mainfrom
WEIZIBIN:bugfix_cache_request_body_buf_release

Conversation

@WEIZIBIN

@WEIZIBIN WEIZIBIN commented Jan 13, 2022 •

Copy link
Copy Markdown
Contributor

now

CacheRequestBodyFilter sets the object ServerWebExchangeUtils.CACHED_REQUEST_BODY_ATTR but cover the previous DataBuffer, and then RemoveCachedBodyFilter loses the reference to the DataBuffer, not releasing the DataBuffer, causing direct memory leaks

after

CacheRequestBodyFilter sets the object to ServerWebExchangeUtils.CACHED_REQUEST_BODY_OBJECT_ATTR that attribute reuse from ReadBodyRoutePredicateFactory

The is essentially a breaking change.

@WEIZIBIN
WEIZIBIN force-pushed the bugfix_cache_request_body_buf_release branch from 7ad6ecf to f8a2f25 Compare January 14, 2022 06:14
@WEIZIBIN WEIZIBIN changed the title bugfix_cache_request_body_buf_release cache body to new attr avoid direct memory leak Jan 14, 2022
@nkonev

nkonev commented Jan 21, 2022 •

Copy link
Copy Markdown
Contributor

It seems ServerWebExchangeUtils.CACHED_REQUEST_BODY_ATTR, previously used in pair (ReadBodyRoutePredicateFactory, AdaptCachedBodyGlobalFilter) also is used in CacheRequestBodyFilter after #1943.

@wuxudong

Copy link
Copy Markdown

Stuck by the same bug, any progress?

@spencergibb

Copy link
Copy Markdown
Member

Is this still an issue?

@WEIZIBIN
WEIZIBIN force-pushed the bugfix_cache_request_body_buf_release branch from f8a2f25 to 9e32410 Compare October 8, 2026 05:51
@WEIZIBIN

WEIZIBIN commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #2842

@WEIZIBIN WEIZIBIN closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants