-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Devashish Datt Mamgain opened SPR-11325 and commented
While working on websockets, I found a bug where duplicate messages were coming. Use case:
- Open web page connect to the websocket connection.
- Open the same page in another tab.
Spring messaging creates 2 different sessions for different tabs which are linked to the same user. Bug is while sending a websocket message to the user, the first tab gets the message one time but the second tab gets the same message 2 times. And if we open more tabs, it keeps on increasing, the 3rd tabs gets the same message 3 times, 4th tab 4 times and so on.
Problem seems to be in DefaultUserDestinationResolver.java in the below code:
for (String sessionId : this.userSessionRegistry.getSessionIds(info.getUser())) {
set.add(getTargetDestination(headers.getDestination(), info.getDestination(), sessionId, info.getUser()));
}Here for the same user, all the sessionIds are fetched and then all destinations to the given user are added as the target destination for the message which is causing the problem as mentioned above.
Affects: 4.0 GA
Reference URL: https://groups.google.com/forum/#!topic/spring-framework-contrib/vtTWovqzKW8
Referenced from: commits b4e48d6