[Kde-pim] Akonadi, maildir and duplicate mails

Martin Koller kollix at aon.at
Sun Feb 1 17:01:49 GMT 2015


I'm hunting the infamous "duplicate emails" bug #283682
I've created a test resource which generates some emails and with it I often can reproduce the problem.
So the setup is: test-resource delivering mails, maildir resource storing mails.
I have setup one filter, which moves the incoming mails to trash.

Basically what happens is that after my resource delivers the mail, the maildir and the mailfilter
get notified about a new mail, and this seems to lead to a timing problem.

In a normal situation (no dup mail), the maildir resource gets triggered in the following order:
itemAdded(), itemMoved(inbox -> trash), retrieveItems(inbox)

however the following leads to duplicating mail:
itemAdded(), retrieveItems(inbox), itemMoved(inbox -> trash)

What I see is that this intermediate retrieveItems() checks the known items in Akonadi against
the currently available files on disk.
Here however Akonadi says: NO items in inbox, but the file is still there (since the itemMoved did not arrive yet),
and therefore maildir thinks: "I got a new mail" and triggers an ItemCreateJob for the already "moved" Item,
leading to the duplicate entry ...

So for me it seems as if the filter agent told Akonadi to move the item, Akonadi did that by changing the
collection id, then maildir got triggered with retrieveItems() and the DB is inkonsistent with what's on disk.

What I do not know:
- Why is retrieveItems() called ?
- How can I avoid this or at least make sure the call comes after itemMoved() ?

Is the concept in Akonadi so that any agent can modify items (here: move) without
the owner resource having a chance to do something _before_ the action is really done in the Akonadi DB ?
What if the move operation can not be done in the backend (maildir), e.g. changed rights, disk full, whatever ... ?

-- 
Best regards/Schöne Grüße

Martin
A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

()  ascii ribbon campaign - against html e-mail 
/\                        - against proprietary attachments

Geschenkideen, Accessoires, Seifen, Kulinarisches: www.lillehus.at
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/



More information about the kde-pim mailing list