Version: 4.7 (using KDE 4.7.3) OS: Linux Akonadi::ItemDeleteJob constructors expect to get either a *non-empty* list of items to be deleted, or a valid collection to be deleted; it does not tolerate an *empty* list of items to be deleted. However, RetrieveItemsJob::Private::storeListResult() in akonadi_mixedmaildir_resource sometimes gives it just that: an empty mServerItemsByRemoteId.values() list. This causes ItemDeleteJob to report error "Invalid collection specified", and Akonadi<-->akonadi_mixedmaildir_resource communication stalls (akonadiconsole debugger shows a transaction BEGIN followed by nothing), and this in turn causes all kinds of major problems in KMail (KMail becomes out of sync with akonadi_mixedmaildir_resource, cannot even open e-mail messages). Reproducible: Sometimes Steps to Reproduce: 1. akonadictl start 2. akonadiconsole 3. In akonadiconsole "Browser" tab, click "Synchronize Folder" on any KMail Folder Actual Results: In akonadiconsole "Agents" tab, status of "KMail Folders" should be "Synchronizing email folder <XYZ>" for some time, then become "Ready" again Expected Results: In akonadiconsole "Agents" tab, status of "KMail Folders" goes to "Synchronizing email folder <XYZ>" forever (at least hours, even with an empty folder)
Created attachment 66099 [details] Workaround in RetrieveItemsJob I'm not sure if this bug should be fixed in RetrieveItemsJob or in ItemDeleteJob. Here is a patch that fixes it in RetrieveItemsJob.
Git commit aedcddf94b1b10b929d244d1063cb61c2c467105 by Allen Winter. Committed on 29/11/2011 at 04:16. Pushed by winterz into branch 'master'. in Private::storeListResult(), don't try to create a delete job for an empty list of items. probably means that the ItemDeleteJob class should assert on such cases so we find other errors like this. Patch by Ahti, thanks! BUG: 287625 MERGE: 4.7 M +34 -32 resources/mixedmaildir/retrieveitemsjob.cpp http://commits.kde.org/kdepim-runtime/aedcddf94b1b10b929d244d1063cb61c2c467105
Git commit 18984cacbd7afda8f86d01bff26083bec4b06b57 by Allen Winter. Committed on 29/11/2011 at 04:16. Pushed by winterz into branch 'KDE/4.7'. in Private::storeListResult(), don't try to create a delete job for an empty list of items. probably means that the ItemDeleteJob class should assert on such cases so we find other errors like this. Patch by Ahti, thanks! BUG: 287625 MERGE: 4.7 (cherry picked from commit aedcddf94b1b10b929d244d1063cb61c2c467105) M +34 -32 resources/mixedmaildir/retrieveitemsjob.cpp http://commits.kde.org/kdepim-runtime/18984cacbd7afda8f86d01bff26083bec4b06b57
A general comment: as a software architect unfamiliar with KMail/Akonadi inner workings, I must say am shocked that Akonadi protocol is designed to be so brittle: that such a small bug in Job implementation can stall the whole communication with an Akonadi resource. As I understand, stalling communication is much worse than crashing, as it pushes Akonadi and its resource more and more out of sync and can perhaps result in data loss. As I understand, I received a bunch of mails via POP3 in KMail, read them, moved between folders etc, with "KMail Folders" resource totally out the loop for several hours.