Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSocket setup payload can cause Netty ByteBuf leak #32424

Closed
pcernocky opened this issue Mar 12, 2024 · 1 comment
Closed

RSocket setup payload can cause Netty ByteBuf leak #32424

pcernocky opened this issue Mar 12, 2024 · 1 comment
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@pcernocky
Copy link

When the RSocket connection is established with a setup payload and the payload is not consumed (deserialized) on the server side (e. g. by not providing @ConnectMapping or not specifying message payload parameter in the @ConnectMapping method), then Netty reports "LEAK: ByteBuf.release() was not called before it's garbage-collected."

The leak can also be triggered on the client side, by specifying RSocketConnector.acceptor() and connecting to a server with setup payload and not consuming the payload on the client side with @ConnectMapping. That's how I discovered it because, on the client side, it's a bit cumbersome to consume the setup payload, which is sent from itself.

Application demonstrating this issue both on server and client is here. Just run the Server.main() and the Client.main() and see both logs.
https://github.com/pcernocky/spring-messaging-rsocket-bug

As I understand it, this condition should be true and the dataBuffer should be released, but it's false. I suspect this line calls release() earlier and the condition above is broken.
Note that, for non-setup payloads, this mechanism works ok. So not reading payload in e. g. request-response operation does not cause a leak.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Mar 12, 2024
@rstoyanchev rstoyanchev added the in: web Issues in web modules (web, webmvc, webflux, websocket) label Mar 19, 2024
@simonbasle simonbasle self-assigned this Apr 18, 2024
@simonbasle simonbasle added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 23, 2024
@simonbasle simonbasle added this to the 6.1.x milestone Apr 23, 2024
@simonbasle simonbasle modified the milestones: 6.1.x, 6.1.7 Apr 25, 2024
@simonbasle
Copy link
Contributor

This should now be fixed. @pcernocky don't hesitate to try out snapshots and tell us if you see any remaining issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

4 participants