[Differential] [Request, 6 lines] D3111: Fix race condition in LoadJob

elvisangelaccio (Elvis Angelaccio) noreply at phabricator.kde.org
Wed Oct 19 09:40:41 UTC 2016


elvisangelaccio created this revision.
elvisangelaccio added a reviewer: rthomsen.
Restricted Application added a subscriber: kde-utils-devel.
Restricted Application added a project: Ark.

REVISION SUMMARY
  `extracttest` has random failures when we check properties with the libarchive
  plugin. This happens because there is a race condition between
  `LoadJob::onFinished()` (where we read some `LoadJob` members) and
  `LoadJob::onNewEntry()` (where we write those members).
  
  `onFinished()` is called when `list()` returns, in `LoadJob::doWork()`.
  But that might happen before `onNewEntry()` is called, since they are executed
  in two different threads.
  
  This patch puts the `onFinished()` call in the event queue, just like the
  single-thread case does (where we emit the `finished` signal from
  `CliInterface`).
  
  An alternative could be using a `DirectConnection` for the `entry` signal, but
  that is more invasive/ugly.

TEST PLAN
  Run `extracttest` a bunch of times, with/without the patch. It should randomly
  fail without the patch, it should always pass with the patch.

REPOSITORY
  rARK Ark

BRANCH
  fix-extracttest

REVISION DETAIL
  https://phabricator.kde.org/D3111

AFFECTED FILES
  kerfuffle/jobs.cpp

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: elvisangelaccio, rthomsen
Cc: kde-utils-devel, tctara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-utils-devel/attachments/20161019/16e13636/attachment.html>


More information about the Kde-utils-devel mailing list