Opened 8 years ago

Last modified 5 years ago

#2964 assigned defect

Race condition while buddy initiation

Reported by: alsroot Owned by: erikos
Priority: Low Milestone: Unspecified
Component: Sugar Version: Git as of bugdate
Severity: Unspecified Keywords:
Cc: sascha_silbe Distribution/OS:
Bug Status: Unconfirmed

Description

The problem is that right after becoming online, buddy (jabber user) is in inconsistent state before all pep (http://xmpp.org/extensions/xep-0163.html) properties will be published on jabber server.

Attachments (1)

0001-Race-condition-while-buddy-initiation-2964.patch (4.0 KB) - added by alsroot 8 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 8 years ago by alsroot

Attached patch is a workaround that shows the affected place in sugar shell code.

comment:2 Changed 8 years ago by sascha_silbe

  • Distribution/OS Unspecified deleted
  • Owner set to erikos
  • Status changed from new to assigned

We should probably call SetProperties right after creating the connection in jarabe.model.neighborhood._Account._prepare_connection(), not in __connection_ready_cb() after the connection has been established.

Nevertheless Sugar should cope with this race condition on the receiver side. As PEP is used we should get notified of the properties as soon as the sender publishes them (PropertiesChanged signal, __buddy_info_updated_cb()).

If I grok the code right, this should be race-free: The signal callbacks get set up in __get_self_handle_cb(), as part of the callback for the Status call in __connection_ready_cb(). The GetProperties call happens in _update_buddy_activities() and __get_contact_attributes_cb(), both times only in response to the signals we subscribed to in __get_self_handle_cb():

We should consider the use case of non-Sugar buddies when fixing the receiver side of this bug: When GetProperties fails, it can be due to this bug (SetProperties called too late on the sender side) or because the buddy isn't running Sugar. We should be able to distinguish these two cases by examining the capabilities (see PEP: Filtered Notifications). In the non-Sugar case we should show the buddy right away. For Sugar buddies we might want to wait for the PropertiesChanged signal, potentially forever.

comment:3 Changed 8 years ago by sascha_silbe

  • Cc sascha_silbe added

comment:4 Changed 5 years ago by godiard

  • Priority changed from Unspecified by Maintainer to Low
Note: See TracTickets for help on using tickets.