Bug 233390 - Names in message list shown twice or more
Summary: Names in message list shown twice or more
Status: RESOLVED FIXED
Alias: None
Product: kdepim
Classification: Applications
Component: messagelist (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR normal
Target Milestone: ---
Assignee: Stephen Kelly
URL:
Keywords: akonadi-ports-regression
Depends on:
Blocks: 223438
  Show dependency treegraph
 
Reported: 2010-04-05 18:41 UTC by Thomas McGuire
Modified: 2010-06-17 23:47 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
etm item modification duplication fix (525 bytes, patch)
2010-06-17 04:13 UTC, Leo Franchi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas McGuire 2010-04-05 18:41:27 UTC
The names in the sender column or shown twice or sometimes even more.
The mail only has one sender, and the viewer also only displays one.

For testing, I created a draft, and the sender column not shows "Thomas McGuire, Thomas McGuire".
Comment 1 Thomas McGuire 2010-04-05 18:42:46 UTC
Note that this doesn't seem to happen on the first selection, one needs to switch to another folder and then back.
Comment 2 Thomas McGuire 2010-04-06 09:55:51 UTC
This is a model bug, so adding Steve to the CC list.

My random guess is that the ETM fetches the items again, and somehow merges the header of the new and the old item, and that creates the duplicate sender.
Comment 3 Till Adam 2010-05-14 16:31:25 UTC
I can reliably trigger this by storing a message as a draft, then editing and storing it as a draft again.
Comment 4 Leo Franchi 2010-06-08 21:34:09 UTC
I'm not sure why this happens, but it's not directly a result of the messagelist.

I think it's a race condition between the messagelist loading the new item, and the ETM backing it.

After the message editor is closed, it fires off an ItemCreateJob that creates the item in the collection. The maildir resource, watching the draft folder, modifies the item by adding a remoteid. This emits a itemModified() signal, that is propagated up to the ETM monitoredItemChanged() method, where the old item (the full mail) and the new item (the full mail with a new remoteid) are merged.

This merge results in duplication of the headers of the KMime::Message::Ptr---the akonadi mail serializer, when deserializing the ENVELOPE part of a message, merges the new envelope with the existing message headers.

So the ETM is now holding mails with incorrectly duplicated headers.

Now,the messagelist loading happens in batches and async. If the update timer is called *between* the item creation and the maildir resource item modification, all is good, because it gets the message before the headers are duplicated. If the update timer fires *after*, it reads the duplicated-headers message, and shows them. 

I'm not sure what the proper fix in Akonadi/ETM is for this, will consult the akonadi gurus :)
Comment 5 Leo Franchi 2010-06-17 04:13:06 UTC
Created attachment 48069 [details]
etm item modification duplication fix

Here's a potential patch to fix the issue, as recommended by Kevin K. I don't know if it's acceptable at all, or if it's the right approach, but I attach it without committing for reference. Comments from Steve, Volker, or other Akonadi-knowledgeable folks are appreciated :)
Comment 6 Volker Krause 2010-06-17 23:47:23 UTC
SVN commit 1139256 by vkrause:

Fix header duplication when using Item::apply().

BUG: 233390


 M  +1 -0      akonadi_serializer_mail.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1139256