Bug 265896

Summary: Akonadi resources churn CPU and consume memory until OOM killed
Product: Akonadi Reporter: Joseph Tate <jtate+kde>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Severity: normal CC: alexandre.bonneau, berend.de.schouwer, ccurtis0+kdebts, cfigura77, cmertes, cruzki123, enachebogdan, ferdinand, meyerm, rutgerhendriks, sergiu, smartins, subscryer, thomas.richard
Priority: NOR    
Version: 1.4.0   
Target Milestone: ---   
Platform: Ubuntu Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Broken/corrupted config

Description Joseph Tate 2011-02-09 17:39:34 UTC
Created attachment 57028 [details]
Broken/corrupted config

Version:           1.4.0 (using KDE 4.5.1) 
OS:                Linux

I'm having kernel trouble that causes my laptop to fail to shutdown completely occasionally.  After one of these crashes, about a minute after logging into KDE, the system would become unresponsive.  I was able to open a top window and capture this:

 3020 jtate 20 0 540m 279m 15m R 32 5.7 0:09.20 akonadi_maildir
 3019 jtate 20 0 553m 283m 16m R 32 5.8 0:09.31 akonadi_ical_re
 3022 jtate 20 0 537m 280m 15m R 32 5.7 0:09.17 akonadi_maildis
 3018 jtate 20 0 544m 275m 16m R 29 5.6 0:08.99 akonadi_birthda
 3024 jtate 20 0 534m 278m 15m R 29 5.7 0:09.07 akonadi_nepomuk
 3027 jtate 20 0 539m 283m 15m R 29 5.8 0:09.29 akonadi_vcard_r

Once while I was in a vconsole, I saw this output several times:

I created a brand new account and akonadi was working with the fresh profile, so I started removing other things and restarting KDE.

type=1503 audit(1297265279.564:33): operation="file_perm" pid=5830 parent=5801 profile="/usr/sbin/mysqld-akonadi" requested_mask="w::" denied_mask="w::" fsuid=1000 ouid=1000 name="/.local/share/akonadi/db_data/mysql.err"

But removing the .local/share/akonadi directory didn't fix it.  Neither did removing the .kde settings folder.

What did fix it was removing my ~/.config/akonadi folder.  With this gone, the system doesn't hang, and my akonadi resource process show 19-20m RES memory use each.

I'll attach the backup of my .config/akonadi folder for forensic purposes.  I've filed this bug in launchpad for Ubuntu, but I don't think it's Ubuntu specific: https://bugs.launchpad.net/ubuntu/+source/akonadi/+bug/709314

Reproducible: Always

Steps to Reproduce:
Restore the akonadi config directory, restart KDE.

Actual Results:  
akonadi started resources start eating memory until your machine swaps itself unresponsive.  Finally the OOM killer extends mercy.

Expected Results:  
Not OOMed

Comment 1 Simon Raffeiner 2011-02-17 16:56:22 UTC
I can confirm this bug on Kubuntu 10.10 with updated KDE 4.6.0 packages, removing ~/.config/akonadi seems to have fixed it.
Comment 2 enachebogdan 2011-05-04 20:37:07 UTC
I can confirm the same identical bug on Mint 10 KDE, so it's not Kubuntu specific.
Deleting ~/.config/akonadi/ fixed it.
Comment 3 subscryer 2011-08-02 11:50:04 UTC
I suffer from the same bug but only with akonadi nepomuk mail feeder, the other processes behave.
I'd rather avoid deleting akonadi data and spend another day or two synchronizing my imap folders... :(
So I'm waiting for a proper solution to the bug.
KDE 4.7 on gentoo here. I think I first configured akonadi in 4.4.
Comment 4 Christophe Giboudeaux 2011-08-28 16:38:44 UTC
there are several reports here that shouldn't be mixed.

in the initial report, 
> type=1503 audit(1297265279.564:33): operation="file_perm" pid=5830 parent=5801
profile="/usr/sbin/mysqld-akonadi" requested_mask="w::" denied_mask="w::"

likely means apparmor went crazy.

The cause of the issue seen on gentoo or mint is probably different
Comment 5 Alexandre Bonneau 2011-10-03 11:47:37 UTC
Same problem here with kubuntu 11.04, using kde 4.6.2.
The akonadi_maildis process eats all ram and swaps before being OOM-killed.

There is two workaround :
- killing the akonadi_maildis 3 times in a row stops akonadi to restart it, or
- as the others said, delete the ~/.config/akonadi folder.

I'm using linux 64 bits, and experiencied some crashes before too.
Comment 6 Ferdinand 2011-10-19 22:07:50 UTC
Same problem here, but using Kubuntu 11.10, just started yesterday.

Akonadi is taking al lot of CPU and all my memory ... till the kernel starts to kill processes. That hapens within 10 minutes after login.

Akonadi is not responding to akonadictl stop, you have to kill it. (Or restart)
Comment 7 cmertes 2011-11-10 16:39:31 UTC
I can confirm the bug. If you want a tarball of the offending .config/akonadi please email me as I don't know what data exactly is in the database. I'm running Kubuntu 11.10 and my X freezes completely. I had to switch to the console in time to see what's happening.
Comment 8 Simon Raffeiner 2011-11-11 13:15:53 UTC
I replaced KDEPIM with Claws Mail and other packages, will no longer be able to help debugging this issue.
Comment 9 Thomas Richard 2011-11-13 13:13:37 UTC
I can confirm this issue as well on Kubuntu 11.10 with KDE 4.7.3

It's damn annoying and renders the desktop unusable
Comment 10 Kazeev Nikita 2011-12-12 22:19:09 UTC
*** This bug has been confirmed by popular vote. ***
Comment 11 meyerm 2012-04-02 07:07:22 UTC
After hitting this problem I updated my KDE 4.7 from opensuse 12.1 to KDE 4.8.1 with akonadi 1.7.1 from the KDE4.8 repository. Problem still persisted. Solution for now was deleting the imap resource taking all the memory and readding it in KMail :-(

See also #278487, #294447, #296706 and perhaps #260647, #290355.
Comment 12 Alexandre Bonneau 2012-04-03 09:36:57 UTC
As a side-note, I figured my RAM was badly damaged, which explained many bugs and corrupted files I observed for a few months.
Since I changed it and removed the ~/.config/akonadi folder, I haven't seen anymore 100% CPU problem with akonadi.

I suspect akonadi has some difficulty to manage corrupted database. That what should be fixed, just in case.
Comment 13 Sergiu Bivol 2012-08-11 08:41:00 UTC
Even if you delete the Akonadi configuration under ~/.config/akonadi, this bug will bite you the next time you try to create a new maildir account in Kmail.

To fix this, run the following command:
mysqlcheck -u root -p --auto-repair --optimize --all-databases
Enter the password for your MySQL root user, NOT the system root user. 

This bug has to do with MySQL database corruption. It happens after a system crash. I did an Alt+SysRq+RSEIUB to reset my machine (unrelated to Akonadi), and the next login greeted me with Akonadi eating my RAM, my CPU, my cat and part of my keyboard.
Comment 14 Sergio Martins 2013-07-12 18:29:28 UTC
Can anyone still reproduce this ?

What are the exact processes that are eating ram? and how much
Comment 15 Denis Kurz 2016-09-24 20:34:36 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 16 Denis Kurz 2017-01-07 22:09:14 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.