ItemFetchJob never finishes

Daniel Vrátil dvratil at kde.org
Tue Feb 14 14:31:08 GMT 2017


On Sunday, February 12, 2017 11:23:00 PM CET David Faure wrote:
> 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?

Yup, the fix looks sensible to me. Thans for looking into it. If you need help 
with the unittest let me know.

Dan

-- 
Daniel Vrátil
www.dvratil.cz | dvratil at kde.org
IRC: dvratil on Freenode (#kde, #kontact, #akonadi, #fedora-kde)

GPG Key: 0x4D69557AECB13683
Fingerprint: 0ABD FA55 A4E6 BEA9 9A83 EA97 4D69 557A ECB1 3683
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20170214/51544fef/attachment.sig>


More information about the kde-pim mailing list