Skip to content

RSocket setup payload can cause Netty ByteBuf leak #32424

Closed
@pcernocky

Description

@pcernocky

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.

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions