Bug 29735 - Roster API semantics are error / race condition prone
Summary: Roster API semantics are error / race condition prone
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-qt (show other bugs)
Version: git master
Hardware: All All
: low trivial
Assignee: Telepathy bugs list
QA Contact: Telepathy bugs list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-22 13:22 UTC by Olli Salli
Modified: 2010-12-30 06:59 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Olli Salli 2010-08-22 13:22:58 UTC
I noticed while fixing the tp-qt4 tests to not have race conditions that the Roster manipulation API has quite error-prone semantics. For example, the PendingOperation returned by Contact::requestPresenceSubscription finishes at *some* point of time, which can be either before, or after, the time the Contact actually signals subscriptionStateChanged() to Asked or Yes, and subscriptionState() starts returning the value corresponding to the new state. The finish point depends on the actual underlying D-Bus event ordering and kernel scheduling decisions. Needless to say, this makes that PendingOperation finish event completely useless - nothing can be assumed of the Contact object's actual state at that point.

Then again, most applications probably don't need to worry about consistency between the PendingOperation and the Contact object state, since they probably just throw away the PendingOperation. However, if you feel that your application is needlessly complex due to this semantics issue, please raise the bug severity and describe your use-case so that we can design more appropriate semantics.
Comment 1 Olli Salli 2010-12-30 06:59:04 UTC
Andre's new code using the Connection.Interface.ContactList D-Bus API fixes this, guaranteeing that the signals are always emitted and Contact state changed before the pending ops finish.

Fix will be in 0.5.2 - but obviously, only when used with a CM that implements the new API.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.