ItemFetchJob never finishes

David Faure faure at kde.org
Sun Feb 12 22:23:00 GMT 2017


On samedi 21 janvier 2017 15:10:42 CET Daniel Vrátil wrote:
> Hey,
> 
> thanks for the output, there is indeed something weird in the ItemRetriever
> code when dealing with multiple requesters. Surprisingly it's something I
> wrote :-) We have a test, but this path was not covered.

Indeed. Due to the QEventLoop in ItemRetriever, testing this code path
requires starting multiple threads in the unittest, AFAICS.

But looking at the debug output when the problem happens, and looking at the code, I think the fix is the following:


diff --git i/src/server/storage/itemretrievalmanager.cpp w/src/server/storage/itemretrievalmanager.cpp
index 65f5e78..382bb9e 100644
--- i/src/server/storage/itemretrievalmanager.cpp
+++ w/src/server/storage/itemretrievalmanager.cpp
@@ -232,6 +232,7 @@ void ItemRetrievalManager::retrievalJobFinished(ItemRetrievalRequest *request, c
             qCDebug(AKONADISERVER_LOG) << "someone else requested item" << request->ids << "as well, marking as processed";
             (*it)->errorMsg = errorMsg;
             (*it)->processed = true;
+            Q_EMIT requestFinished(*it);
             it = mPendingRequests[request->resourceId].erase(it);
         } else {
             ++it;


The code does Q_EMIT requestFinished(request); further down, but the other requests for
the same IDs are being removed without emitting the signal.

Not tested yet, I'll look into writing that unittest, but I'm pretty sure this is the fix.
What do you think?

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5




More information about the kde-pim mailing list