Bug 385532

Summary: Rebuild of database results in kmail crash and infinte loop
Product: [Frameworks and Libraries] Akonadi Reporter: Axel Braun <axel.braun>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: REPORTED ---    
Severity: critical CC: aaronw
Priority: NOR    
Version: 5.6.1   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Axel Braun 2017-10-09 18:47:16 UTC
As for whatever reason the search database is messed up again (seems like akonadi cant deal with frequent suspend/hibernate/wake-up activities), I decided to go for a rebuild, this time using a postgres backend.

After I deleted ~/.local/share/akonadi and started akonadi again, from what I saw so far - great. CPU temperatures much lower than under mysql.

But, after some time:

org.kde.pim.kimap: Connection to server lost 3 --> No idea - is this IMAP resource 3?
Pass a valid window to KWallet::Wallet::openWallet().
org.kde.pim.kimap: Connection to server lost 3
org.kde.pim.kimap: Connection to server lost 3
Pass a valid window to KWallet::Wallet::openWallet().
org.kde.pim.kimap: Connection to server lost 3
org.kde.pim.kimap: Connection to server lost 3
Pass a valid window to KWallet::Wallet::openWallet().
org.kde.pim.kimap: Connection to server lost 3

What does the '3' indicate? IMAP resource 3? Network still up, and I could access all accounts via webmail

Now starting KMail:

org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver: Error code: "23505"
org.kde.pim.akonadiserver: DB error: "ERROR: duplicate key value violates unique constraint \"collectiontable_parentandnameindex\"\nDETAIL: Key (parentid, name)=(7, drafts) already exists.\n(23505)"
org.kde.pim.akonadiserver: Error text: "ERROR: duplicate key value violates unique constraint \"collectiontable_parentandnameindex\"\nDETAIL: Key (parentid, name)=(7, drafts) already exists.\n(23505) QPSQL: Es konnte keine Abfrage erzeugt werden"
org.kde.pim.akonadiserver: Query: "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, enabled, syncPref, displayPref, indexPref, cachePolicyInherit, cachePolicyCheckInterval, cachePolicyCacheTimeout, cachePolicySyncOnDemand, cachePolicyLocalParts, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14) RETURNING id"
org.kde.pim.akonadiserver: Error during insertion into table "CollectionTable" "ERROR: duplicate key value violates unique constraint \"collectiontable_parentandnameindex\"\nDETAIL: Key (parentid, name)=(7, drafts) already exists.\n(23505) QPSQL: Es konnte keine Abfrage erzeugt werden"
org.kde.pim.akonadiserver: DATABASE ERROR:
org.kde.pim.akonadiserver: Error code: "23505"
org.kde.pim.akonadiserver: DB error: "ERROR: duplicate key value violates unique constraint \"collectiontable_parentandnameindex\"\nDETAIL: Key (parentid, name)=(7, drafts) already exists.\n(23505)"
org.kde.pim.akonadiserver: Error text: "ERROR: duplicate key value violates unique constraint \"collectiontable_parentandnameindex\"\nDETAIL: Key (parentid, name)=(7, drafts) already exists.\n(23505) QPSQL: Es konnte keine Abfrage erzeugt werden"
org.kde.pim.akonadiserver: Query: "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, enabled, syncPref, displayPref, indexPref, cachePolicyInherit, cachePolicyCheckInterval, cachePolicyCacheTimeout, cachePolicySyncOnDemand, cachePolicyLocalParts, isVirtual) VALUES (:0, :1, :2, :3, :4, :5, :6, :7, :8, :9, :10, :11, :12, :13, :14) RETURNING id"
org.kde.pim.akonadiserver: Error during insertion into table "CollectionTable" "ERROR: duplicate key value violates unique constraint \"collectiontable_parentandnameindex\"\nDETAIL: Key (parentid, name)=(7, drafts) already exists.\n(23505) QPSQL: Es konnte keine Abfrage erzeugt werden"

...and KMail crashed with this. The error message it was showing:

Im E-Mail-Programm ist ein schwerwiegender Fehler aufgetreten. Das Programm wird beendet.
Die Fehlermeldung lautet: Could not create collection drafts, resourceId: 16

(Sorry for the german message....)

But there is no such resource (16) in ~/.config/akonadi/ ....

KMail crashed, but akonadi seems to run. It is issuing always the same messages, as it looks for the same elements:

org.kde.pim.akonadiserver: processing retrieval request for item (77740)  parts: ("RFC822")  of resource: "akonadi_maildir_resource_0"
org.kde.pim.akonadiserver: ItemRetrievalJob finished for request 0x7f6102c658d0 , error: ""
org.kde.pim.akonadiserver: posting retrieval request for items (77739)  there are  0  queues and  0  items in mine
org.kde.pim.akonadiserver: ItemRetrievalJob Akonadi::Server::ItemRetrievalJob(0x5562b06d97e0) started for request 0x7f6102c7cfe0
org.kde.pim.akonadiserver: processing retrieval request for item (77739)  parts: ("RFC822")  of resource: "akonadi_maildir_resource_0"
org.kde.pim.akonadiserver: ItemRetrievalJob finished for request 0x7f6102c7cfe0 , error: ""
org.kde.pim.akonadiserver: posting retrieval request for items (77740)  there are  0  queues and  0  items in mine
org.kde.pim.akonadiserver: ItemRetrievalJob Akonadi::Server::ItemRetrievalJob(0x7f6102c7de60) started for request 0x7f6102c7acf0
org.kde.pim.akonadiserver: processing retrieval request for item (77740)  parts: ("RFC822")  of resource: "akonadi_maildir_resource_0"
org.kde.pim.akonadiserver: ItemRetrievalJob finished for request 0x7f6102c7acf0 , error: ""
org.kde.pim.akonadiserver: posting retrieval request for items (77739)  there are  0  queues and  0  items in mine
org.kde.pim.akonadiserver: ItemRetrievalJob Akonadi::Server::ItemRetrievalJob(0x7f6102c7ae60) started for request 0x7f6102c7e1f0
org.kde.pim.akonadiserver: processing retrieval request for item (77739)  parts: ("RFC822")  of resource: "akonadi_maildir_resource_0"
org.kde.pim.akonadiserver: ItemRetrievalJob finished for request 0x7f6102c7e1f0 , error: ""
org.kde.pim.akonadiserver: posting retrieval request for items (77740)  there are  0  queues and  0  items in mine
org.kde.pim.akonadiserver: ItemRetrievalJob Akonadi::Server::ItemRetrievalJob(0x7f6102c7e070) started for request 0x7f6102c7d3c0

Looks like this is an infinite loop, as I let it running during the night, but the messages did not change...

Any idea what I could try? Akonadi/Kmail remains unusable. running openSUSE Tumbleweed
Comment 1 Axel Braun 2018-05-28 10:55:14 UTC
On an upgraded Leap15 system I see he error message
Connection to server lost 3 
as stated below again. What should that message tell me?


Akonadi is running for more than 20h in between, heavily loading the CPU, but Kmail is not crashing (yet)
Comment 2 Aaron Williams 2021-06-14 23:32:55 UTC
I am seeing this now with the very latest Akonadi (OpenSUSE 15.3 + latest KDE)
Comment 3 Aaron Williams 2021-06-14 23:44:47 UTC
Note that after deleting everything under .local/share/akonadi/file_db_data and search_db/email and restarting akonadi and running fsck it is working again.