Bug 327513

Summary: IMAP server disconnect leads to failure in mail retrieval/corrupt akonadi cache
Product: [Frameworks and Libraries] Akonadi Reporter: itsef-admin
Component: IMAP resourceAssignee: Christian Mollekopf <chrigi_1>
Status: RESOLVED UNMAINTAINED    
Severity: grave CC: abone27, groszdanielpub, gtwilliams, jonathan.verner, kde.bugzilla.2012, kdepim-bugs, kitts.mailinglists, pete, thiago.bauermann, thomas, vkrause
Priority: NOR    
Version: 1.10.80   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description itsef-admin 2013-11-12 16:50:35 UTC
Our IMAP server (Kolab -> cyrus) is shut down briefly for back-up purposes each night. When I leave Kontact/KMail running over night, all e-mail accounts will be offline in the morning.

Very frequently, KMail fails to collect any more new mail in the INBOX of an account that has been offline. Restarting Kontact/KMail does not change that. Using "Update Folder" (F5) or "Check Mail" has no effect. Restarting akonadi also does not help. Also: There is no indication to the user whatsoever that mail fetching does not work, which causes users to potentially miss important mail.

Whenever this happens, the only way to get the inbox updated again is to start akonadiconsole and do a "clear akonadi cache" on that particular inbox, plus sometimes also restarting Kontact. Obviously, this also deletes all tags, flags and other information.

Funny enough, this problem only affects the inbox - all mail in subfolders (I have sieve filters running on the server) is still retrieved, flagged and displayed correctly.

Given that this bug makes daily mail usage in KMail unreliable, I'll mark this as "Grave".

Reproducible: Sometimes
Comment 1 Kishore 2013-11-13 12:55:18 UTC
I have a similar problem repeating more often i think since 4.11 update. It only seems to affect the inbox folder. I am connected to GMail with disconnected imap.
Comment 2 Kishore 2013-11-15 03:41:57 UTC
Again, im now experiencing this on my inbox folder. According to akonadiconsole, the folder size is 1.8GiB.

Is there anything information i can provide to help the situation? I would really not like to dump cache and download 1.8GiB again. Is there anything i can do to fix it from this point on?
Comment 3 Kishore 2013-11-15 03:47:40 UTC
I just noticed that if i open akonadiconsole and on the browser tab if i select the corrupted inbox folder, akonadiconsole starts consuming loads of RAM and keeps growing. It consumed something like 1.5 GB in about 30 seconds when i closed it. akonadi console itself continues to be responsive in the UI during this time.
Comment 4 Kevin Ottens 2013-11-16 07:27:48 UTC
The IMAP resource has a new maintainer, reassigning to him.
Comment 5 itsef-admin 2013-11-18 15:36:39 UTC
Additional data point: As a workaround, I now get cron to stop akonadi each night before the IMAP server goes offline for backup, then start akonadi again after the server has come back. I have done so for several days now and up until now KMail kept working. Of course, this does not help against unscheduled downtimes of the server.
Comment 6 Grósz Dániel 2014-10-22 20:16:05 UTC
I have similar problems when the client loses connection and reconnects, such as when disconnecting from and then connecting to a wifi network, or when waking up from suspend. I fight with KMail/Akonadi every time after a wake-up from suspend-to-disk to make it get my e-mail. (I use gmail.)

There are several manifestations of bug(s) in this area:
- Usually it appears to get my e-mail. In this case, it often appears to hangs on one of the folders; sometimes it appears to complete the check, but actually doesn't show the new e-mails.
- Sometimes KMail will show folders offline, and there is no way to make them online. This is probably Bug 338960,

- To solve the problem, I have to issue 'akonadictl restart'. This usually suffices; restarting KMail doesn't.
- Sometimes I have to restart KMail too.
- A further variation is the one described in this bug report, where the cache needs to be cleared manually; I haven't run into this.

These issues make KMail seriously unreliable nowadays.
Comment 7 Jonathan Verner 2015-04-15 05:47:28 UTC
I can confirm the behaviour described by Grósz Dániel in comment #6.  I can also confirm that restarting akonadi (akonadictl restart) usually helps.
Comment 8 Denis Kurz 2016-09-24 20:33:34 UTC
This bug has only been reported for versions older than KDEPIM 4.14 (at most akonadi-1.3). Can anyone tell if this bug still present?

If noone confirms this bug for a recent version of akonadi (part of KDE Applications 15.08 or later), it gets closed in about three months.
Comment 9 Denis Kurz 2017-01-07 22:11:44 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.