Project

General

Profile

Bug #230

Race Condition in user-roster-management-ext

Added by Glenn Engstrand about 7 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
2011-08-12
Due date:
% Done:

100%

Estimated time:
8.00 h
Database:
n/a
Applicable version:
5.2.0-master
Source Code Disclaimer:

Description

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.

Associated revisions

Revision d245e700 (diff)
Added by Andrzej Wójcik IoT 1 CloudTigaseTeam over 4 years ago

Fixes #230 - Added synchronized block for modification of offline user to deal with race condition

History

#1 Avatar?id=6023&size=24x24 Updated by Artur Hefczyc TigaseTeam about 7 years ago

  • Status changed from New to Feedback
  • Assignee changed from Artur Hefczyc to Andrzej Wójcik

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?

#2 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam almost 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?

#3 Avatar?id=6023&size=24x24 Updated by Artur Hefczyc TigaseTeam over 6 years ago

  • Target version changed from tigase-server-5.1.0 to tigase-server-5.2.0

#4 Avatar?id=6023&size=24x24 Updated by Artur Hefczyc TigaseTeam almost 6 years ago

  • Estimated time set to 8.00 h

#5 Avatar?id=6023&size=24x24 Updated by Artur Hefczyc TigaseTeam over 5 years ago

  • Target version changed from tigase-server-5.2.0 to tigase-server-5.2.1

#6 Avatar?id=6023&size=24x24 Updated by Artur Hefczyc TigaseTeam over 5 years ago

  • Status changed from Feedback to New

#7 Avatar?id=6023&size=24x24 Updated by Artur Hefczyc TigaseTeam over 4 years ago

  • Assignee changed from Artur Hefczyc to Andrzej Wójcik
  • Target version changed from tigase-server-5.2.1 to tigase-server-7.0.0
  • Applicable version set to 5.2.0-master

#8 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam over 4 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset tigase-server|commit:d245e70068507ae07f955b00335820da82f49ef7.

#9 Updated by Andrzej Wójcik IoT 1 CloudTigaseTeam over 4 years ago

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

#10 Avatar?id=6023&size=24x24 Updated by Artur Hefczyc TigaseTeam over 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF