Skip to content

Fix buffer leak in RSocket SETUP frame handling - #37105

Closed
yashsiwacha wants to merge 1 commit into
spring-projects:mainfrom
yashsiwacha:fix/issue-37026-rsocket-buffer-leak
Closed

Fix buffer leak in RSocket SETUP frame handling#37105
yashsiwacha wants to merge 1 commit into
spring-projects:mainfrom
yashsiwacha:fix/issue-37026-rsocket-buffer-leak

Conversation

@yashsiwacha

Copy link
Copy Markdown

Remove the explicit payload.retain() call in MessagingRSocket#handleConnectionSetupPayload because the setup payload is fully owned by the SocketAcceptor, and MessagingRSocket#handle properly strips metadata, wraps the data in a DataBuffer, and eventually releases the initial buffer. The extra .retain() caused the underlying Netty buffer reference count to drop to 1 rather than 0 on success.

Additionally, handle early failures in RSocketMessageHandler#responder by releasing the connection setup payload explicitly if responder creation fails (e.g. invalid mime types).

Issue: #37026

Remove the explicit `payload.retain()` call in `MessagingRSocket#handleConnectionSetupPayload`
because the setup payload is fully owned by the SocketAcceptor, and
`MessagingRSocket#handle` properly strips metadata, wraps the data in
a DataBuffer, and eventually releases the initial buffer. The extra
`.retain()` caused the underlying Netty buffer reference count to drop
to 1 rather than 0 on success.

Additionally, handle early failures in `RSocketMessageHandler#responder`
by releasing the connection setup payload explicitly if responder
creation fails (e.g. invalid mime types).

Issue: spring-projects#37026
Signed-off-by: Yash Siwach <yashsiwach07@gmail.com>
@yashsiwacha
yashsiwacha force-pushed the fix/issue-37026-rsocket-buffer-leak branch from 93da4c5 to 2579793 Compare August 3, 2026 10:42
@bclozel

bclozel commented Aug 3, 2026

Copy link
Copy Markdown
Member

Thanks but this was already assigned.

@bclozel bclozel closed this Aug 3, 2026
@bclozel bclozel added the status: declined A suggestion or change that we don't feel we should currently apply label Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: declined A suggestion or change that we don't feel we should currently apply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants