D28181: [contacts/ContactModifyJob] Avoid race condition
Igor Poboiko
noreply at phabricator.kde.org
Sat Mar 21 11:16:47 GMT 2020
poboiko created this revision.
poboiko added a reviewer: dvratil.
Herald added a project: KDE PIM.
poboiko requested review of this revision.
REVISION SUMMARY
This patch is similar to D28178: [contacts] Fix ContactCreateJob with a photo <https://phabricator.kde.org/D28178>. Although `uid` is populated, and we can
freely dispatch both contact and photo modify requests in parallel, the
following race condition still sometimes happens:
1. Contact modify request dispatched
2. Contact photo modify request dispatched
3. Photo reply arrives
At this point, `d->lastContact` is not yet populated, and we call
`processNextContact()`, which repeats steps 1 and 2 for the very same contact.
Which could happen again and again, if photo reply arrives first again.
Instead, I suggest to fire photo modify request only after we receive reply
for contact modify request, ensuring everything happens in the following order:
1. Contact modify request dispatched
2. Contact modify reply received
3. Contact photo modify request dispatched
4. Contact photo reply received
TEST PLAN
1. Modify a contact via KAddressBook
2. Check logs 3.1) (without patch) Bunch of modify requests somtimes gets fired 3.2) (with patch) Only one modify request gets fired
REPOSITORY
R477 KGAPI Library
BRANCH
no-race-modify (branched from master)
REVISION DETAIL
https://phabricator.kde.org/D28181
AFFECTED FILES
src/contacts/contactmodifyjob.cpp
To: poboiko, dvratil
Cc: kde-pim, fbampaloukas, dcaliste, dvasin, rodsevich, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20200321/554287f2/attachment.html>
More information about the kde-pim
mailing list