Bug 290355 - akonadi_mixedmaildir_resource consumes too much memory
Summary: akonadi_mixedmaildir_resource consumes too much memory
Status: RESOLVED DUPLICATE of bug 260647
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: Mixed Maildir resource (show other bugs)
Version: 4.7
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-01 23:31 UTC by Bruno Haible
Modified: 2013-07-17 07:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Haible 2012-01-01 23:31:31 UTC
Version:           4.7.2 (using KDE 4.7.3) 
OS:                Linux

kmail 4.7.4, akonadi 4.7.4.

I imported an archive of 1 GB of old mails into kmail by adding a local
"kmail maildir" in the settings, then pressed Ctrl-F5 (recursive refresh).
It took a while, produced a database of 0.5 GB on disk, and after that,
there was an akonadi_mixedmaildir_resource process that took ca.
2.4 GB of virtual memory and 1.8 GB of resident memory (= 50% of RAM on
a 4 GB machine). Every kmail operation (view a mail, select different
folder, etc.) triggered massive disk activity. Often, the
akonadi_mixedmaildir_resource process took over 100% of CPU time for
several minutes.

The situation lasted until I logged out, which happened to terminate the
akonadi_mixedmaildir_resource process.

Reproducible: Didn't try

Steps to Reproduce:
Add a local "kmail maildir" resource for 1 GB of old mail.
Press Ctrl-F5 (recursive refresh on it) in the folder view.
Wait until it's refreshed.
Try to view different folders - sluggish and slow.
Close and restart kmail.
Try to view different folders - still sluggish and slow.


Actual Results:  
An akonadi_mixedmaildir_resource process eats of 2 GB of RAM and lots of CPU time.

Expected Results:  
Regardless of the total size of mailboxes to refresh, the total size of the
kmail related processes (including akonadi* and mysqld) should remain bounded
below 200 MB.
Comment 1 Bruno Haible 2012-01-29 12:40:13 UTC
It took me 1 day of debugging to find the cause: When I type Ctrl-L (Fetch mail) in kmail, it sends a
"full recursive sync/refresh" request to the akonadi_mixedmaildir_resource process. Here is the stack trace:


#0  Akonadi::FileStore::CollectionFetchJob::CollectionFetchJob (this=0x735f10, collection=..., type=Akonadi::FileStore::CollectionFetchJob::Recursive, session=0x717f40) at /usr/src/packages/BUILD/kdepim-runtime-4.7.4/resources/shared/filestore/collectionfetchjob.cpp:55
#1  0x00007f3fa4963fa2 in Akonadi::FileStore::AbstractLocalStore::fetchCollections (this=0x6dba40, collection=..., type=Akonadi::FileStore::CollectionFetchJob::Recursive) at /usr/src/packages/BUILD/kdepim-runtime-4.7.4/resources/shared/filestore/abstractlocalstore.cpp:415
#2  0x000000000041b464 in MixedMaildirResource::retrieveCollections (this=0x7e7790) at /usr/src/packages/BUILD/kdepim-runtime-4.7.4/resources/mixedmaildir/mixedmaildirresource.cpp:240
#3  0x00007f3fa45fafeb in Akonadi::ResourceBase::qt_metacall (this=0x7e7790, _c=QMetaObject::InvokeMetaMethod, _id=3, _a=0x7fff912c3e90) at /usr/src/packages/BUILD/kdepimlibs-4.7.4/build/akonadi/moc_resourcebase.cpp:129
#4  0x0000000000420684 in MixedMaildirResource::qt_metacall (this=0x7e7790, _c=QMetaObject::InvokeMetaMethod, _id=27, _a=0x7fff912c3e90) at /usr/src/packages/BUILD/kdepim-runtime-4.7.4/build/resources/mixedmaildir/mixedmaildirresource.moc:109
#5  0x00007f3fa0c0459a in QMetaObject::activate (sender=0x71e280, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3287
#6  0x00007f3fa45fec55 in Akonadi::ResourceScheduler::executeFullSync (this=0x71e280) at /usr/src/packages/BUILD/kdepimlibs-4.7.4/build/akonadi/resourcescheduler_p.moc:127
#7  0x00007f3fa45fc971 in Akonadi::ResourceScheduler::executeNext (this=0x71e280) at /usr/src/packages/BUILD/kdepimlibs-4.7.4/akonadi/resourcescheduler.cpp:269
#8  0x00007f3fa45fec03 in Akonadi::ResourceScheduler::qt_metacall (this=0x71e280, _c=QMetaObject::InvokeMetaMethod, _id=15, _a=0x705e50) at /usr/src/packages/BUILD/kdepimlibs-4.7.4/build/akonadi/resourcescheduler_p.moc:116
#9  0x00007f3fa0c0814a in QObject::event (this=0x71e280, e=<optimized out>) at kernel/qobject.cpp:1226
#10 0x00007f3fa1828c54 in notify_helper (e=0x6f04c0, receiver=0x71e280, this=0x688ef0) at kernel/qapplication.cpp:4481
#11 QApplicationPrivate::notify_helper (this=0x688ef0, receiver=0x71e280, e=0x6f04c0) at kernel/qapplication.cpp:4453
#12 0x00007f3fa182dae1 in QApplication::notify (this=0x7fff912c4c40, receiver=0x71e280, e=0x6f04c0) at kernel/qapplication.cpp:4360
#13 0x00007f3fa253c1e6 in KApplication::notify (this=0x7fff912c4c40, receiver=0x71e280, event=0x6f04c0) at /usr/src/packages/BUILD/kdelibs-4.7.4/kdeui/kernel/kapplication.cpp:311
#14 0x00007f3fa0bf181c in QCoreApplication::notifyInternal (this=0x7fff912c4c40, receiver=0x71e280, event=0x6f04c0) at kernel/qcoreapplication.cpp:787
#15 0x00007f3fa0bf4bf8 in sendEvent (event=0x6f04c0, receiver=0x71e280) at kernel/qcoreapplication.h:215
#16 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x664800) at kernel/qcoreapplication.cpp:1428
#17 0x00007f3fa0c1c0b3 in sendPostedEvents () at kernel/qcoreapplication.h:220
#18 postEventSourceDispatch (s=<optimized out>) at kernel/qeventdispatcher_glib.cpp:277
#19 0x00007f3f9b4c858d in g_main_dispatch (context=0x68b880) at gmain.c:2425
#20 g_main_context_dispatch (context=0x68b880) at gmain.c:2995
#21 0x00007f3f9b4c8d88 in g_main_context_iterate (context=0x68b880, block=<optimized out>, dispatch=1, self=<optimized out>) at gmain.c:3073
#22 0x00007f3f9b4c8f59 in g_main_context_iteration (context=0x68b880, may_block=1) at gmain.c:3136
#23 0x00007f3fa0c1c50f in QEventDispatcherGlib::processEvents (this=0x664430, flags=<optimized out>) at kernel/qeventdispatcher_glib.cpp:422

The workaround is to *never* press Ctrl-L, and instead only fetch the mail in a specific resource,
such as "Fetch mail in... <Resourcename>".

Unfortunately, this action is not available through a keyboard shortcut. I have to go through the "File" menu
and a submenu each time I want to fetch mail.
Comment 2 Sergio Martins 2013-07-17 07:59:26 UTC

*** This bug has been marked as a duplicate of bug 260647 ***