Users logged in to multiple servers do not get messages in sessions on remote servers [SPR-13800] #18373
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
Stuart Greenlees opened SPR-13800 and commented
It looks like there may be an issue in the spring-messaging
MultiServerUserRegistry
class. We have a spring boot application (version 1.3) that uses websockets (spring-websocket 4.2.3 and spring-messaging 4.2.3) and runs in Pivotal Cloud Foundry scaled across a number of jvms. We are using a rabbitMQ backend stomp Broker. When our application is deployed a user may have multiple browser sessions which could potentially be distributed across multiple server instances using the same security Principal. When the application usesconvertAndSendToUser
to send a targeted message to the user we want that message to go to all browsers that the user has open. However what we are finding is that the websocket user from the server that is processing the message is overwriting the websocket user from other servers. This means that if the user has a websocket connection using the same security principal on two of the servers then the message will only be delivered to one browser.Here is the code from
MultiServerUserRegistry
were the overwrite occurs:The attached sample application https://github.com/stuartgreenlees/springboot-websocket-multiserver (based on the Spring Websocket getting started guide) demonstrates the issue. If you start 2 instances of the application and log into server A with the users ‘mike’ and ‘jim’ and create a websocket connection for both, then hitting the
/userssessions
endpoint on both servers will show that websocket users for both ‘mike’ and ‘jim’ are visible on both servers. If you then log into server ‘B’ as ‘mike’ then only the user belonging to mike on the current server is visible not both.Affects: 4.2.3
Reference URL: https://github.com/stuartgreenlees/springboot-websocket-multiserver
Issue Links:
Referenced from: commits 6aa216a, 68f6cf9
The text was updated successfully, but these errors were encountered: