Skip to content

Additional browser tabs receive duplicate messages sent to user destination [SPR-11325] #15949

@spring-projects-issues

Description

@spring-projects-issues

Devashish Datt Mamgain opened SPR-11325 and commented

While working on websockets, I found a bug where duplicate messages were coming. Use case:

  1. Open web page connect to the websocket connection.
  2. 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

Metadata

Metadata

Assignees

Labels

in: messagingIssues in messaging modules (jms, messaging)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions