-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
In StompSubProtocolHandler, when handling a message received from the client, if an exception is thrown when sending the message to the output MessageChannel, the default error handler sends an ERROR frame to the client.
According to the STOMP 1.2 specification, the broker must close the connection after sending an ERROR frame: https://stomp.github.io/stomp-specification-1.2.html#ERROR
This is what I have been observing:
- Before the client connects
$ netstat -tnp | grep 25833 | wc -l
5
- With a breakpoint in
StompSubProtocolHandlerbefore the error is sent:
$ netstat -tnp | grep 25833 | wc -l
6
- After the error is sent:
$ netstat -tnp | grep 25833 | wc -l
6
- After closing the client:
$ netstat -tnp | grep 25833 | wc -l
5
This is an issue for me because I'm checking a JWT token in an interceptor for the CONNECT frame. If the server says the token is expired, the client is supposed to renew it and re-try connecting. However, as the connection is never closed by the server, the client never re-tries connecting.
Maybe ExceptionWebSocketHandlerDecorator was supposed to close the connection, but as the exception is caught in StompSubProtocolHandler, it never has a chance to do so.
Edit: This happens only when StompSubProtocolHandler.errorHandler is null. When using StompSubProtocolErrorHandler the behavior is correct.