Projects tigase _server server-core Issues #75
Race Condition in user-roster-management-ext (#75)
Closed
Glenn Engstrand opened 1 decade ago

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.

Artur Hefczyc commented 1 decade ago

Andrzej, you have been working on this script recently, could you please comment on this? Maybe the problem is fixed in an updated version of the script?

Andrzej Wójcik (Tigase) commented 1 decade ago

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?

Andrzej Wójcik (Tigase) commented 1 decade ago

Applied in changeset tigase-server|commit:d245e70068507ae07f955b00335820da82f49ef7.

Andrzej Wójcik (Tigase) commented 1 decade ago

I've added synchronization on user repository instance to deal with race condition issue, when roster of offline user was modified concurrently.

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
RedmineID
230
Version
tigase-server-7.0.0
Estimation
8h
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#75
Please wait...
Page is in error, reload to recover