D15959: Wait for the extraction process to finish before scheduling

Igor Poboiko noreply at phabricator.kde.org
Fri Oct 5 08:57:11 BST 2018


poboiko created this revision.
poboiko added reviewers: Baloo, Frameworks.
Herald added projects: Frameworks, Baloo.
Herald added a subscriber: kde-frameworks-devel.
poboiko requested review of this revision.

REVISION SUMMARY
  Right now, a race condition might happen. Signal `FileContentIndexer::done` is connected to `FileIndexScheduler::scheduleIndexing`,
  which does scheduling only when there is no active threads (NB: `FileContentIndexer` is running inside one).
  The signal is emitted in the very end of `FileContentIndexer::run`, which should be fine. However, after `run` is finished,
  it also calls destructor for local `ExtractorProcess process`, which destroys `QProcess m_extractorProcess`, which itself waits for the process to finish.
  
  If `FileContentIndexer::done` signal is processed before process is finished, scheduling won't happen and baloo will be stuck in `ContentIndexing` state.
  (which is exactly what pointed me to this issue: `File Indexer Monitor` application showed that baloo is stuck in `ContentIndexing`, when it clearly should be `Idle`)
  
  I suggest instead to emit `FileContentIndexer::done` signal only when `ExtractorProcess` is finished.

TEST PLAN
  I can no longer reproduce indexer being stuck in `ContentIndexing` phase.

REPOSITORY
  R293 Baloo

BRANCH
  wait-extractor-finish (branched from master)

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

AFFECTED FILES
  src/file/extractorprocess.cpp
  src/file/extractorprocess.h
  src/file/filecontentindexer.cpp

To: poboiko, #baloo, #frameworks
Cc: kde-frameworks-devel, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20181005/2778f0b6/attachment.html>


More information about the Kde-frameworks-devel mailing list