Bug 264266 - Akonadi IMAP shows duplicate emails that were uploaded [Exchange Server]
Summary: Akonadi IMAP shows duplicate emails that were uploaded [Exchange Server]
Status: RESOLVED FIXED
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: IMAP resource (show other bugs)
Version: 1.4.80
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Kevin Ottens
URL:
Keywords:
Depends on: 259214
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-25 17:19 UTC by Thiago Macieira
Modified: 2011-09-17 17:00 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thiago Macieira 2011-01-25 17:19:55 UTC
Version:           1.4.80 (using Devel) 
OS:                Linux

When I send an email, the email is uploaded to the Exchange Server's "Sent Items" folder. Every message I sent is shows duplicated in the folder listing, both in Kontact and in Akonadi Console.

Reproducible: Always

Steps to Reproduce:
1. Send an email to anyone


Actual Results:  
The email is shown twice in the Sent Items folder

Expected Results:  
The email is shown only once.

OS: Linux (i686) release 2.6.36.2-server-1mnb
Compiler: gcc
Akonadi 1.4.95 (revision: 45edeb8)

Looking at the item details on Akonadi Console, I notice a couple of differences:

1) both items have Akonadi IDs, but only one of them has a Remote ID
2) the item with a valid Remote ID has the headers reflown (i.e., line breaks added)
3) on the Internals tab, the Size differs by as much as 4% (no clue why)
4) on the Internals tab, the item without remote ID has flags "\SEEN" and "$SENT", while the one with remote ID has only "\SEEN"
   Note that Exchange does NOT support the $SENT flag, so it's lost while uploading.
Comment 1 Thiago Macieira 2011-01-25 17:26:10 UTC
Note that I can reproduce this with any email uploaded to the IMAP server, provided I sent it.

It seems to be related to the $SENT flag. If I move an email that I didn't send from another IMAP server onto any folder in the Exchange server, it works as expected.

If I move an email that I did send from another IMAP server's "sent-mail" folder onto the Exchange server, it gets duplicated in the view.

Again: the email is NOT duplicated in the server, just in the view and Akonadi DB.
Comment 2 Thiago Macieira 2011-01-25 17:45:27 UTC
Probably caused by bug 259214.
Comment 3 Thiago Macieira 2011-04-11 16:15:43 UTC
Probably depends on bug 259214
Comment 4 Volker Krause 2011-04-17 00:00:19 UTC
I guess the duplication is not cleaned up by the next sync? Could you check (with akonadiconsole for example) if one of the duplicated mails has no remote identifier? That would explain the behavior and bug 259214 contains a possible server response to indeed cause an empty RID. 

Possible workaround for these cases (IMAP UID not obtainable from the server) might be to assign a random RID instead of an empty one. Items with empty RIDs are protected during syncing as they are considered newly added locally and not yet stored on the server. It's a safety feature, but prevents recovery in this case.
Comment 5 Thiago Macieira 2011-04-17 00:04:51 UTC
One of the duplicated emails does not have a remote ID.

Note this happens in one of my Exchange account configs, but not on another (same akonadi, same account)
Comment 6 Volker Krause 2011-04-17 18:32:12 UTC
See https://git.reviewboard.kde.org/r/101147/ for a possible fix.
Comment 7 Thiago Macieira 2011-04-26 17:24:00 UTC
Duplication has disappeared after the fix.
Comment 8 Thiago Macieira 2011-05-03 11:44:42 UTC
I take that back, there is one duplication left: an email I sent with attachment. The duplication is not visibile on the webmail interface.

Running akonadi enterprise5.0-20110117-20-gfc57f8c, kdepimlibs 7899ee6ce68052d82b610319987f21fc176ba93c, kdepim-runtime v4.6beta5-23-gda482c4, kdepim v4.6beta5-119-ge30055a.

I haven't been able to reproduce the issue while sending the same attachment again. It might be related to sending an email while the IMAP agent is stalled (bug 270691).
Comment 9 Kevin Ottens 2011-09-17 17:00:41 UTC
OK, marking that one fixed (bug 270691 still being open).