Spring WebSocket Stomp tomcat cluster with user destinations sends message to wrong subscriber. [SPR-17228] #21761
Labels
in: messaging
Issues in messaging modules (jms, messaging)
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Maksim Orlov opened SPR-17228 and commented
Tomcat uses AtomicLong for generating id for web socket sessions
at
then the id transferred to Spring WebSocket package
at
In case of user destination subscriptions
controller class
will pass message to user queue on RabbitMQ with name "events-user0".
Sending message to "/app/thread"
will trigger controller with
@MessageMapping
. But in case when there is the second node and other client (different login) will also subscribe to "/user/queue/events" and its session id is the same as on the first node (because names just simple sequences ) The second user will receive the message instead of the first user, because first node created RibbitMQ queue with name "events-user0" and the second node subscribed to the +same+ queue.The generated unique ids for the WebSocket session or different names for Broker queues can handle this issue.
Affects: 5.0.7
Reference URL: #17258
Attachments:
Issue Links:
Referenced from: commits b17e7c3, 3302798
The text was updated successfully, but these errors were encountered: