Race Condition in user-roster-management-ext
The section of this groovy script that updates a user's roster when he or she is offline first loads the entire roster. Then it updates the one relevant item in the roster. Finally, it saves the roster to the repository. When an offline user gets two friend requests at the same time, there is a timing window in which the first request gets lost if the second request loads the roster before the first request saves the roster.
#2 Updated by Andrzej Wójcik about 7 years ago
- Assignee changed from Andrzej Wójcik to Artur Hefczyc
I've checked and there is a problem with race condition as Session Manager uses getPacketFrom() for hashCodeForPacket used to determine queue to assign packet to. In this case many senders sends packets with diffrent "from" attribute and diffrent packetFrom as they use diffrent connections, and that creates race condition. Simplest solution would be to put whole read-modify-save in synchronized block, but it can create performance issues. Any other solutions for that?