possible patch for endless hanging resources

Daniel Vrátil dvratil at kde.org
Tue Apr 18 11:11:05 BST 2017


On Monday, April 17, 2017 8:26:14 PM CEST Martin Koller wrote:
> Hi,

Hi Martin,

> 
> I'm trying to find a solution for resources (in my case maildir) showing
> "please wait" when retrieving an email but never finishing.
> 
> I found out that this is easily reproducible when - for whatever reason -
> there is a duplicate remoteId in the database.
> 
> What happens here is that the maildir resource is asked for an item via
> MaildirResource::retrieveItems() which it loads from disk and calls the
> baseclass ResourceBase::itemsRetrieved(rv). Inside this, ItemCreateJobs are
> created and sent to the Akonadi Server.
> 
> The Server however finds the "Multiple remote Ids" in
> AkAppend::parseStream(), and returns false. This error however results in
> the resource in ResourceBasePrivate::slotItemSyncDone() just emitting the
> error via emit q->error(job->errorString());
> but what seems to be missing is a DBUS reply being sent to kmail, so it
> waits forever on a feedback ...
> 
> I'm using now the following simple fix, which solves the problem.
> 
> diff --git a/src/agentbase/resourcebase.cpp b/src/agentbase/resourcebase.cpp
> index 0cc6ab282..845645df2 100644
> --- a/src/agentbase/resourcebase.cpp
> +++ b/src/agentbase/resourcebase.cpp
> @@ -1363,7 +1363,8 @@ void ResourceBasePrivate::slotItemSyncDone(KJob *job)
>      Q_Q(ResourceBase);
>      if (job->error() && job->error() != Job::UserCanceled) {
>          emit q->error(job->errorString());
> -    } else if (scheduler->currentTask().type ==
> ResourceScheduler::FetchItems) { +    }
> +    if (scheduler->currentTask().type == ResourceScheduler::FetchItems) {
>          scheduler->currentTask().sendDBusReplies(QString());
>      }
>      scheduler->taskDone();
> 
> 
> Do you think this is the correct fix ?

Nice find! Looks like you nailed it.

Just one comment: we should not send an empty QString() via DBus on error, so 
please change it to

sendDBusReplies((job->error && job->error() != Job::UserCanceled) ? job-
>errorString() : QString());

With this change, feel free to commit into stable branch (and close #378189 if 
you think it solves the issue fully).

Cheers,
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: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20170418/42dfcc12/attachment.sig>


More information about the kde-pim mailing list