Skip to content

StompSubProtocolHandler does not close the connection after sending an ERROR frame #23039

Closed

Description

@bgK

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 StompSubProtocolHandler before 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.

Activity

  1. added
    status: waiting-for-triage
    on May 27, 2019
  2. self-assigned this
    on May 28, 2019
  3. added
    in: messaging
    type: bug
    and removed
    status: waiting-for-triage
    on May 28, 2019
  4. added this to the 5.1.8 milestone on May 28, 2019
  5. added a commit that references this issue on Apr 6, 2024
    d2ec876
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: messagingtype: bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions