Skip to content

Conversation

madwind
Copy link

@madwind madwind commented Sep 4, 2025

Fix: ensure activeConnection is closed after sending error

Motivation:

When integrating with Spring Security over RSocket, if authentication or authorization fails, the server emits an error internally but does not actually send it to the client.
At the same time, the activeConnection is kept open, leaving the client with no response and the server holding a dangling connection.

Modifications:

Added a call to activeConnection.sendErrorAndClose(rSocketErrorException) so that the error is delivered to the client and the connection is properly closed.

Result:

On authentication/authorization failure, the client will now receive an error instead of hanging indefinitely.

The connection will also be closed, preventing resource leaks and inconsistent states.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant