This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Akonadi is getting confused?

Tags: None
(comma "," separated)
User avatar
davidbryant
KDE Developer
Posts
11
Karma
0
OS

Akonadi is getting confused?

Mon May 03, 2021 7:02 pm
I use KMail2 as my email client all the time. Abiut once a month I comb through my "inbox" file to move some messages to trash, and others to the appropriate archival folder. I have ~35,000 emails saved in the whole directory tree. Oh -- I'm running Gentoo Linux, KMail 5.16.3 (20.12.3), KDE Frameworks 5.80.0, Qt 5.15.2, and KDE Plasma 5.20.5.

I think this may be a bug related to the 20.12.3 packages. I compiled / installed those on April 6. There were a lot of them. Both Akonadi and KMail2 were rebuilt that day. This is the first time I have cleaned up my inbox since the new version went in almost a month ago. I'll file this as a bug if I can't learn much in the forum -- just thought that since this is easier, I'd try here first. Plus Ben Cooksley tells me that if I create enough posts in this forum, I'll be allowed to create a signature on my profile page. 8-)

Anyway, everything was going fine until I tried to move a certain message to trash. I saw a brief warning message "Moving to trash failed". After that, three messages became inaccessible. When I try to open these messages, I get a different error message:
Code: Select all
Unable to fetch message from backend (collection -1).:Unable to retrieve item from resource:[LRCONFLICT] Resource akonadi_maildir_resource_0 tries to modify item 101543 (1608061094817.R217.localhost:2,S) (i...

The other two affected messages show the same error, with a different Akonadi ID / item code, and a different file name. I can locate the files the messages are talking about, in .local/share/local-mail/inbox/cur, and all three messages are there. And they correspond with the inoperative entries in KMail's message list. So whatever is causing the hangup must be part of Akonadi's behind-the-curtain voodoo.

As luck would have it, I had stopped the Akonadi serrver and restarted it in a terminal window when this problem arose. I had a similar problem earlier today, so I had rebooted my system and was being a bit careful while trying (again) to clean up the inbox. Here's some terminal output that appears to be relevant.
Code: Select all
org.kde.pim.akonadiserver.search: Executing search "kmail2-2875677424-SearchSession"
org.kde.pim.akonadiserver.search: Search  "kmail2-2875677424-SearchSession" done (without remote search)
org.kde.pim.akonadiserver.search: Executing search "kmail2-2875677424-SearchSession"
org.kde.pim.akonadiserver.search: Search  "kmail2-2875677424-SearchSession" done (without remote search)
org.kde.pim.akonadiserver: ItemRetrievalJob for request 1319 finished
org.kde.pim.akonadiserver.search: Executing search "kmail2-2875677424-SearchSession"
org.kde.pim.akonadiserver.search: Search  "kmail2-2875677424-SearchSession" done (without remote search)
org.kde.pim.akonadiserver.search: Executing search "kmail2-2875677424-SearchSession"
org.kde.pim.akonadiserver.search: Search  "kmail2-2875677424-SearchSession" done (without remote search)
org.kde.pim.akonadiserver.search: Executing search "kmail2-2875677424-SearchSession"
org.kde.pim.akonadiserver.search: Search  "kmail2-2875677424-SearchSession" done (without remote search)
org.kde.pim.akonadiserver: Error while handling command ModifyItems on connection akonadi_maildir_resource_0 (0x557dcf6831b0)
org.kde.pim.akonadiserver: ItemRetrievalJob for request 1328 finished with error: "Unable to retrieve item from resource: [LRCONFLICT] Resource akonadi_maildir_resource_0 tries to modify item 101507 (1617992884688.R540.localhost:2,S) (in collection 11) with dirty payload, aborting STORE."
org.kde.pim.akonadiserver: Handler exception when handling command FetchItems on connection MessageViewer-94667889766560 (0x557dcf696430) : Unable to fetch item from backend (collection -1) : Unable to retrieve item from resource: [LRCONFLICT] Resource akonadi_maildir_resource_0 tries to modify item 101507 (1617992884688.R540.localhost:2,S) (in collection 11) with dirty payload, aborting STORE.
org.kde.pim.akonadiserver: Error while handling command ModifyItems on connection akonadi_maildir_resource_0 (0x557dcf6831b0)
org.kde.pim.akonadiserver: ItemRetrievalJob for request 1329 finished with error: "Unable to retrieve item from resource: [LRCONFLICT] Resource akonadi_maildir_resource_0 tries to modify item 101507 (1617992884688.R540.localhost:2,S) (in collection 11) with dirty payload, aborting STORE."
org.kde.pim.akonadiserver: Handler exception when handling command FetchItems on connection kmail2-2875677424 (0x557dcf665e30) : Unable to fetch item from backend (collection -1) : Unable to retrieve item from resource: [LRCONFLICT] Resource akonadi_maildir_resource_0 tries to modify item 101507 (1617992884688.R540.localhost:2,S) (in collection 11) with dirty payload, aborting STORE.
org.kde.pim.akonadiserver.search: Executing search "searchUpdate-1620064153"
org.kde.pim.akonadiserver.search: Search  "searchUpdate-1620064153" done (without remote search)
org.kde.pim.akonadiserver.search: Search update for collection "OpenInvitations" ( 15 ) finished: all results:  0 , removed results: 0
org.kde.pim.akonadiserver.search: Executing search "searchUpdate-1620064153"
org.kde.pim.akonadiserver.search: Search  "searchUpdate-1620064153" done (without remote search)
org.kde.pim.akonadiserver.search: Search update for collection "DeclinedInvitations" ( 16 ) finished: all results:  0 , removed results: 0
org.kde.pim.akonadiserver.search: Executing search "searchUpdate-1620064153"
org.kde.pim.akonadiserver.search: Search  "searchUpdate-1620064153" done (without remote search)
org.kde.pim.akonadiserver.search: Search update for collection "Last Search" ( 143 ) finished: all results:  112 , removed results: 0
org.kde.pim.akonadiserver: Error while handling command ModifyItems on connection akonadi_maildir_resource_0 (0x557dcf6831b0)
org.kde.pim.akonadiserver: ItemRetrievalJob for request 1330 finished with error: "Unable to retrieve item from resource: [LRCONFLICT] Resource akonadi_maildir_resource_0 tries to modify item 101536 (1618046328917.R279.localhost:2,S) (in collection 11) with dirty payload, aborting STORE."
[more of the same ...]

Any suggestions will be received with gratitude. Thanks!
--
David Bryant
Canyon Lake, Texas
https://davidcbryant.net


David Bryant
Canyon Lake, Texas
https://davidcbryant.net
Massimiliano
Registered Member
Posts
10
Karma
0
OS

Re: Akonadi is getting confused?

Tue May 04, 2021 7:52 am
I am not able to help much in detail but I recently stumbled upon a post mentioning something similar.

It seems there is a history of data loss with Akonadi and possibly Bug #360834 is the one related to your issues.

You could try to run akonadictl fsck to obtain further debug info.
User avatar
davidbryant
KDE Developer
Posts
11
Karma
0
OS

Re: Akonadi is getting confused?

Tue May 04, 2021 3:31 pm
Massimiliano wrote:You could try to run akonadictl fsck to obtain further debug info.

Thank you for the suggestion. I had already done that. And I filed bug reports with Gentoo, and at KDE's bugzilla page. I've been using KMail since 2003, so I'm pretty familiar with all the belly-aching about Akonadi. This isn't even the worst trouble it has ever caused me. But it's close.

Here's some terminal output.
Code: Select all
david@localhost ~ $ akonadictl fsck 2>&1|grep ^Found
Found 13 external files.
Found 13 external parts.
Found no unreferenced external files.
Found 0 parts to be moved to external files
Found 0 parts to be moved to database
Found 5 collections without RID.
Found 0 items without RID.
Found 3001 dirty items.

That was yesterday. I noticed that the "dirty items" were the messages that I couldn't display. I closed KMail, copied my messages to a backup location, then cleared most of my messages out of the "live" KMail directory structure (~.local/share/local-mail on my Gentoo system). Luckily for me, only a few of the "dirty" items were in KMail's "native" folders (inbox, outbox, sent-mail, trash, drafts, & templates). It's easy to deal with the messages in "custom" folders -- you can just use Dolphin with "cut" and "paste" on entire folders. With the "native" folders you have to cut and paste individual files.

Anyway, after I had cleared the "dirty" messages from KMail's directories, I started KMail, forcing Akonadi to erase most of the internal pointers to its relational database structure. I closed KMail and stopped Akonadi, then moved the messages back into the "live" directory. This time when I restarted KMail all the "dirty" items had been fixed. I had to open my message folders one by one to force Akonadi to rebuild its relational database pointers ... that took quite a while, because I had about 100 folders to process. But today it's all patched up.

Code: Select all
david@localhost ~ $ akonadictl fsck 2>&1|grep ^Found
Found 158 external files.
Found 158 external parts.
Found no unreferenced external files.
Found 0 parts to be moved to external files
Found 0 parts to be moved to database
Found 5 collections without RID.
Found 0 items without RID.
Found 0 dirty items.

--
David Bryant
Canyon Lake, Texas


David Bryant
Canyon Lake, Texas
https://davidcbryant.net
kdedin
Registered Member
Posts
1
Karma
0
OS

Re: Akonadi is getting confused?

Wed Sep 22, 2021 10:26 pm
I sometimes get ghost emails in kmail - they look like duplicates and cannot be deleted
however I found that I can remove them as follows
1. get the mysql process used by akonadi
Code: Select all
❯ ps -ef | ag mysql
zog       3341  3332  0 23:04 ?        00:00:00 /usr/sbin/mysqld --defaults-file=/home/zog/.local/share/akonadi/mysql.conf --datadir=/home/zog/.local/share/akonadi/db_data/ --socket=/run/user/1000/akonadi/mysql.socket --pid-file=/run/user/1000/akonadi/mysql.pid
zog       3988  2391  0 23:14 pts/1    00:00:00 ag mysql

2. extract the socket part
Code: Select all
❯ ps -ef | ag mysql | awk '{print $11}'
--socket=/run/user/1000/akonadi/mysql.socket

3. build a sql statement
❯ cat akonadictl.sql
Code: Select all
───────┬───────────────────────────────────────────────────────────
       │ File: akonadictl.sql
───────┼───────────────────────────────────────────────────────────
   1   │ use akonadi;
   2   │ delete from pimitemtable where remoteid is null;
   3   │ commit;
───────┴───────────────────────────────────────────────────────────

4. put it all together
Code: Select all
❯ mysql `ps -ef |ag mysql|gawk -e '{print $11}'` < akonadictl.sql


HTH
User avatar
davidbryant
KDE Developer
Posts
11
Karma
0
OS

Re: Akonadi is getting confused?

Thu Sep 23, 2021 10:50 am
kdedin wrote:I sometimes get ghost emails in kmail - they look like duplicates and cannot be deleted

snip ...
HTH


The procedure you described has recently been added to the KMail documentation. It should show up in the 21.08 release of KMail ;) .

https://docs.kde.org/trunk5/en/kmail/km ... error.html


David Bryant
Canyon Lake, Texas
https://davidcbryant.net
User avatar
raphaelra
Registered Member
Posts
209
Karma
0
OS

Re: Akonadi is getting confused?

Thu Sep 23, 2021 1:12 pm
You can do it in akonadiconsole, register "DB Console" as well.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]