Akonadi errors with GMail account

Daniel Vrátil dvratil at kde.org
Thu Nov 29 22:49:28 GMT 2018


On Thursday, 29 November 2018 07:03:09 CET Szőts Ákos wrote:
> Dear Developers,

Hi Szőts,

> 
> I consider myself as a regular end-user in terms of e-mail client usage. I
> have a GMail account with IMAP and I would like to send and receive e-mails
> within KMail/Kontact. I have some folders synchronised besides all of the
> [GMail] default ones. I started with clean Akonadi profile (deleted
> everything related beforehand).

Do you have "Download emails for offline use" checked in IMAP account settings? 
From some of the errors below, I suspect you don't but want to make sure.

> Despite portraying an average user I encountered so many bugs and hiccups
> (which even made using KMail blatantly difficult) that I decided to collect
> most of them from a 30-minute long session. These are which an average user
> using GMail and KMail encounter often in my opinion.
> 
> I know that some bugs are difficult to reproduce, therefore my idea is to
> list the errors and if you consider them rather bad for user experience,
> I' ll compile the latest KMail/Akonadi duo and I help you to debug the
> exact issue and, if you have time to create them, to apply your patches and
> provide you fast feedback on their usefulness.

Many thanks! I'm currently super-busy with dayjob, but I'll be back to hacking 
on KDE since mid-December, then I'll dive into those issues and start 
providing some patches, hopefully :)

> 
> I use a quite recent openSUSE Tumbleweed rolling distro with KMail and
> Akonadi 18.08.1.
> 
> The errors from my user experience on GUI:
> - Akonadi server eats 10+ GB of memory until I shut it down [1] (I created a
> heaptrack profile there)

Awesome, many thanks for the heaptrack profile, extremely helpful!

> - I can only refresh a folder only once until “akonadictl restart” 

Sounds like something gets stuck in the IMAP resource, probably the internal 
task scheduler. When you refresh a folder, open Akonadi Console, right-click 
the IMAP resource and select "Show task list". What tasks does it list?

> - Some mails I cannot move to another folder failing with a dialogue stating 
this ("cannot move item" or "Unable to execute query")

Hmm, weird :( Any logs from Akonadi Server that coincide with you triggering 
this event?

> - After some minutes of synchronisation the preview pane stucks in
> "Retrieving folder contents. Please wait...” message when I try to open a
> new mail.

This is very likely caused by the resource internal task scheduler getting 
stuck - when it's stuck it can't provide the email content to KMail and the 
whole thing gets stuck :(

> 
> The errors are from console (from about a 30-minute run):
> - org.kde.pim.akonadicore: Error during ItemSync:  "Multiple merge
> candidates, aborting" 

This one  has been haunting us for a long time. No fix yet, I haven't observer 
a reliable way to get a folder into this inconsistent state.

> - Qt WebEngine seems to be initialized from a plugin.
> Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute
> before constructing QGuiApplication. 

That's probably coming from kmail, akregator or Kontact. @Laurent, can you 
look at it?

> - qt.network.ssl: QSslSocket::startClientEncryption: cannot start handshake 
> on non-plain connection 
> -org.kde.pim.ksmtp: Socket error: 2 "Remote server closed connection" 

Those two may be related. Maybe something is wrong with your configuration? Can 
you double-check your SMTP account settings, or copy-paste it here (without 
username and password, obviously, just the hostname, port, encryption and 
authentication method)?

> - org.kde.pim.akonadicore: Creating/updating items from the
> akonadi database failed: “” [50+ times] 

Haven't seen this one yet :/ If nothing else, we should fix the error message 
to actually show the reason :)

> - org.kde.pim.akonadicore: Creating/updating items from the akonadi database 
failed: "Multiple merge candidates, aborting” [10+ times] 

Already discussed above

> - org.kde.pim.akonadiprivate: Error: failed to remove part file “/home/
aki/.local/share/akonadi/file_db_data/79/1051679_r0” [with 100+
> different files, access rights are ok] 

Do the files actually exist? I wonder if this is because when the payload is 
supposed to be expired from the cache it's removed the disk, but the SQL query 
to update the database fails, leading to this inconsistency.

Anyway, runing "akonadictl fsck" should fix these problems.

> - org.kde.pim.akonadiserver: DATABASE ERROR:
> -- org.kde.pim.akonadiserver:   Error code: "1205"
> -- org.kde.pim.akonadiserver:   DB error:  "Lock wait timeout exceeded; try
> restarting transaction" 
> -- org.kde.pim.akonadiserver:   Error text: "Lock wait timeout exceeded; try 
> restarting transaction QMYSQL3: Unable to execute query"
> -- org.kde.pim.akonadiserver:   Query: "UPDATE PimItemTable
> SET rev = ?, remoteId = ?, remoteRevision = ?, gid = ?, collectionId = ?,
> mimeTypeId = ?, datetime = ?, atime = ?, dirty = ?, size = ? WHERE ( id = ?
> )" org.kde.pim.akonadiserver: Error during updating record with id 351516 
> in table "PimItemTable" "Lock wait timeout exceeded; try restarting 
transaction QMYSQL3: Unable to execute query"

I wonder why only MySQL has this kind of issue, haven't seen that on Postgres. 
I don't have an easy reproducer, but I have some ideas on how to approach 
this.

> - org.kde.pim.akonadiserver: Protocol exception: Failed to write data to 
stream 
> -org.kde.pim.akonadicontrol: ProcessControl: Application "/usr/bin/
akonadi_imap_resource" stopped unexpectedly ( “The process has crashed” )
> - org.kde.pim.akonadicontrol: Application '/usr/bin/akonadi_imap_resource' 
> crashed. No restart! 

The protocol exception is probably caused by the resource crashing and 
suddenly disconnecting from the Akonadi Server. You should see DrKonqi popping 
up when it crashes. Could you get a backtrace?

> org.kde.pim.akonadiserver: Payload file "/home/aki/.local/share/akonadi/
> file_db_data/19/1052219_r0"  could not be open for reading!
> - org.kde.pim.akonadiserver: Error:  "No such file or directory"

It's weird that your DB got into this inconsistent state: I've never seen this 
happen anywhere. However, "akonadictl fsck" should fix this.

> - !org.kde.pim.imapresource: Called item() while state holds multiple items!

I see this occasionally too, it's hard to reproduce and I have no clue where 
the call is happening from. Attaching GDB to the Resource and setting a 
breakpoint to the line that prints this message might help. If you are able to 
do it yourself it would be awesome.

> - ”Item query returned empty result set"

This does not necessarily indicate an error (the bug really is that we print 
it as one).

> - QFont::setPixelSize: Pixel size <= 0 (0) [20+ times]

Again probably something from KMail or Kontact. Setting a breakpoint on 
QFont::setPixelSize with condition on size<=0 might help us find where in our 
code this gets called with the wrong argument.

> - org.kde.pim.akonadicore: ""

:-/ Useful....

> - org.kde.pim.imapresource: Detected inconsistency in local cache, we're
> missing some messages. Server:  98582  Local:  98515 
> org.kde.pim.imapresource: Refetching complete mailbox.

Happens with Gmail sometimes, because Gmail's IMAP is crap. I don't have a 
solution for this one. It just leads to the resource re-downloading the entire 
folder, which sucks a lot, but at least it's "self-healing"

> - Tokenizer Warning: 8Bit character ' õ   [with different letters]

I guess this is triggered by malformed emails that contain non-encoded non-
latin1 characters in headers.

> - org.kde.pim.akonadicontrol: "AgentManager::agentInstanceSynchronize" 
> Agent instance  "akonadi_maildir_resource_0"  has no resource interface! 

I supose this is something that can happen soon after start when the Agent has 
registered itself to DBus (so we learn about it) but did not register it's 
interface to the bus, so we can't call it. It's a race condition, maybe we 
could check for the iface and try again in a second or so.

> -
> QDBusConnection: name 'org.freedesktop.Akonadi.Control' had owner '' but we
> thought it was ':1.4330' 

This is just a log message from Qt saying that a process has registered it's 
name to DBus, not an error.

> - org.kde.pim.akonadiserver: "Cannot connect to agent instance with 
identifier 'akonadi_imap_resource_5', error message: ''"

I think this is the same race condition as with the missing maildir resource 
interface.

> - QIODevice::read (QLocalSocket): device not open [20+ times]

This is related to the IMAP resource crash as well.

> 
> If you had time to pin down the most severe ones, I'd be happy to help you
> debugging them.

If you can find a way how to reliably trigger the SQL error or how to break a 
folder so that it stops syncing and says "Mutliple merge candidates", that 
would be a huge help, as those issues are extremely hard to debug without 
being able to reproduce the situation reliably.

> 
> Thank you very much!

Many thanks again for collecting the issues! 

Cheers,
Daniel

> 
> All the best,
> 
> Ákos
> 
> [1]: https://mail.kde.org/pipermail/kdepim-users/2018-November/001650.html


-- 
Daniel Vrátil
www.dvratil.cz | dvratil at kde.org
IRC: dvratil on Freenode (#kde, #kontact, #akonadi, #fedora-kde)

GPG Key: 0x4D69557AECB13683
Fingerprint: 0ABD FA55 A4E6 BEA9 9A83 EA97 4D69 557A ECB1 3683
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20181129/fe5f1913/attachment.sig>


More information about the kde-pim mailing list