[kmail2] [Bug 323068] New: Exponential growth of CollectionFetchJobs (infinite loop)

Thiago Macieira thiago at kde.org
Thu Aug 1 05:52:44 BST 2013


https://bugs.kde.org/show_bug.cgi?id=323068

            Bug ID: 323068
           Summary: Exponential growth of CollectionFetchJobs (infinite
                    loop)
    Classification: Unclassified
           Product: kmail2
           Version: Git (master)
          Platform: Compiled Sources
                OS: Linux
            Status: UNCONFIRMED
          Severity: grave
          Priority: NOR
         Component: folders
          Assignee: kdepim-bugs at kde.org
          Reporter: thiago at kde.org

I don't know what caused this. Downgrading to a previous build of akonadi +
kdepim* did not help. This problem happens now with the build from April 11 as
well as the latest sources (as of right now).

Whenever Kontact / KMail is running, it is constantly requesting a full folder
listing, for whatever reason. Here's what I can tell from debugging and from
Akonadi Console:

Job tracker shows that KMail is creating *two* Akonadi::CollectionFetchJobs at
a time, two or three times per second. Since each job takes about a quarter
second to complete running, there's a build up of jobs. That is, every second,
KMail is requesting 1.25 to 1.5 second of work from the Akonadi Server. This
does not stop.

The Debugger in Akonadi Console shows an endless stream of:
 [red] 24 LSUB 0 INF (MIMETYPE (message/rfc822)) () 
[blue] * 420 419 (NAME "Common Folders" MIMETYPE (message/rfc822
inode/directory) REMOTEID ".Common Folders" REMOTEREVISION "" RESOURCE
"akonadi_imap_resource_3" VIRTUAL 0 CACHEPOLICY (INHERIT true INTERVAL -1
CACHETIMEOUT 60 SYNCONDEMAND true LOCALPARTS (ENVELOPE HEAD)) AccessRights
"wcdCD" imapacl "anyone lrswipcda %% " collectionannotations
"/vendor/cmu/cyrus-imapd/partition default" timestamp "1375301134") 
[a lot more blue]
[blue] 24 OK List completed 

In stderr, kontact is printing these two messages over and over again:
kontact(8751)/libakonadi Akonadi::SpecialCollectionsPrivate::emitChanged:
Emitting changed for "akonadi_maildir_resource_0"
kontact(8751)/libakonadi Akonadi::SpecialCollectionsPrivate::emitChanged:
Emitting defaultFoldersChanged.

(see below for the lines in LSUB that contained "akonadi_maildir_resource_0")

The backtrace of that function is:
#0  Akonadi::SpecialCollectionsPrivate::emitChanged (this=0xda54f0,
resourceId=...)
    at /home/thiago/src/kde4/kde/kdepimlibs/akonadi/specialcollections.cpp:76
#1  0x00007ffff686f5ce in Akonadi::SpecialCollections::registerCollection
(this=0xddf780, type=..., collection=...)
    at /home/thiago/src/kde4/kde/kdepimlibs/akonadi/specialcollections.cpp:266
#2  0x00007ffff6880046 in Akonadi::SpecialCollectionsDiscoveryJob::slotResult
(this=0x9c7190, job=<optimized out>)
    at
/home/thiago/src/kde4/kde/kdepimlibs/akonadi/specialcollectionsdiscoveryjob.cpp:68
#3  0x00007ffff6c7bb2a in QMetaObject::activate (sender=0x16bf8f0,
m=0x7ffff711f460, local_signal_index=3, argv=
    0x7fffffffc8d0) at
/home/thiago/src/qt/qt-4.8/src/corelib/kernel/qobject.cpp:3547
#4  0x00007ffff6f62442 in KJob::result (this=this at entry=0x16bf8f0,
_t1=_t1 at entry=0x16bf8f0)
    at /home/thiago/obj/kde4/kdelibs/kdecore/kjob.moc:207
#5  0x00007ffff6f62480 in KJob::emitResult (this=0x16bf8f0) at
/home/thiago/src/kde4/kdelibs/kdecore/jobs/kjob.cpp:318

I should note that mDefaultResourceId is "akonadi_maildir_resource_0" (a match)
in frame 0.

The next CollectionFetchJob is created from:
#0  Akonadi::CollectionFetchJob::CollectionFetchJob (this=0x18c85d0,
collection=..., type=
    Akonadi::CollectionFetchJob::Recursive, parent=0x1951090)
    at /home/thiago/src/kde4/kde/kdepimlibs/akonadi/collectionfetchjob.cpp:103
#1  0x00007ffff687fbce in Akonadi::SpecialCollectionsDiscoveryJob::start
(this=0x1951090)
    at
/home/thiago/src/kde4/kde/kdepimlibs/akonadi/specialcollectionsdiscoveryjob.cpp:54
#2  0x00007fffa8122ead in MailCommon::Kernel::initFolders (this=0xda3bb0)
    at /home/thiago/src/kde4/kde/kdepim/mailcommon/kernel/mailkernel.cpp:155
#3  0x00007ffff6c7bb2a in QMetaObject::activate (sender=0xdb29c0,
m=0x7ffff69581a0, local_signal_index=1, argv=0x0)
    at /home/thiago/src/qt/qt-4.8/src/corelib/kernel/qobject.cpp:3547
#4  0x00007ffff686e188 in Akonadi::SpecialCollectionsPrivate::emitChanged
(this=0xdb9250, resourceId=...)
    at /home/thiago/src/kde4/kde/kdepimlibs/akonadi/specialcollections.cpp:86

(note: this is a release build; the frame for slot
MailCommon::Kernel::slotDefaultCollectionsChanged is omitted is not present
above, but it calls initFolders()).

Conclusion:
1) when KMail starts, I suppose MailCommon::Kernel::initFolders is called to
initialise the folder listing
2) MailCommon::Kernel::initFolders creates a
Akonadi::SpecialMailCollectionsDiscoveryJob job (derived from
Akonadi::SpecialCollectionsDiscoveryJob)
3) when Akonadi::SpecialCollectionsDiscoveryJob finishes,
Akonadi::SpecialCollectionsDiscoveryJob::slotResult is called
4) Akonadi::SpecialCollectionsDiscoveryJob::slotResult iterates over the result
(201 folders). For two folders, it calls:
68                 
d->mSpecialCollections->registerCollection(collection.attribute<SpecialCollectionAttribute>()->collectionType(),
collection);
  The two folders have mRemoteId = "outbox" and mRemoteId = "caixa de saída"
(don't ask me why one is localised and the other isn't).
5) because of those calls, Akonadi::SpecialCollectionsPrivate::emitChanged gets
called
6) since those two folders have resourceId == mDefaultResourceId, the
defaultCollectionsChanged() signal gets called, which ends up calling
MailCommon::Kernel::initFolders
7) repeat ad nauseam


Reproducible: Always

Steps to Reproduce:
(for me, at least)
1. Start KMail

Actual Results:  
KMail's UI is responsive, but reading any email is impossible after a while,
since the message lists do not update and the mail contents do not show.

Expected Results:  
Reading email is possible.

The lines in the LSUB result that contain "akonadi_maildir_resource_0" are:

* 9 4 (NAME "caixa de entrada" MIMETYPE (message/rfc822 inode/directory)
REMOTEID "caixa de entrada" REMOTEREVISION "1375310411000" RESOURCE
"akonadi_maildir_resource_0" VIRTUAL 0 CACHEPOLICY (INHERIT true INTERVAL -1
CACHETIMEOUT 1 SYNCONDEMAND true LOCALPARTS (ENVELOPE))
SpecialCollectionAttribute "inbox" ENTITYDISPLAY "(\"caixa de entrada\"
\"mail-folder-inbox\" \"\" ())" newmailnotifierattribute "") 
* 6 4 (NAME "caixa de saída" MIMETYPE (message/rfc822 inode/directory) REMOTEID
"caixa de saída" REMOTEREVISION "0" RESOURCE "akonadi_maildir_resource_0"
VIRTUAL 0 CACHEPOLICY (INHERIT true INTERVAL -1 CACHETIMEOUT 1 SYNCONDEMAND
true LOCALPARTS (ENVELOPE)) SpecialCollectionAttribute "outbox" ENTITYDISPLAY
"(\"caixa de saída\" \"mail-folder-outbox\" \"\" ())") 
* 7 4 (NAME "enviado" MIMETYPE (message/rfc822 inode/directory) REMOTEID
"enviado" REMOTEREVISION "1375309940000" RESOURCE "akonadi_maildir_resource_0"
VIRTUAL 0 CACHEPOLICY (INHERIT true INTERVAL -1 CACHETIMEOUT 1 SYNCONDEMAND
true LOCALPARTS (ENVELOPE)) SpecialCollectionAttribute "sent-mail"
ENTITYDISPLAY "(\"enviados\" \"mail-folder-sent\" \"\" ())") 
* 11 4 (NAME "lixo" MIMETYPE (message/rfc822 inode/directory) REMOTEID "lixo"
REMOTEREVISION "1368747529000" RESOURCE "akonadi_maildir_resource_0" VIRTUAL 0
CACHEPOLICY (INHERIT true INTERVAL -1 CACHETIMEOUT 1 SYNCONDEMAND true
LOCALPARTS (ENVELOPE)) SpecialCollectionAttribute "trash" ENTITYDISPLAY
"(\"lixo\" \"user-trash\" \"\" ())") 
* 12 4 (NAME "modelos" MIMETYPE (message/rfc822 inode/directory) REMOTEID
"modelos" REMOTEREVISION "" RESOURCE "akonadi_maildir_resource_0" VIRTUAL 0
CACHEPOLICY (INHERIT true INTERVAL -1 CACHETIMEOUT 1 SYNCONDEMAND true
LOCALPARTS (ENVELOPE)) SpecialCollectionAttribute "templates" ENTITYDISPLAY
"(\"modelos\" \"document-new\" \"\" ())") 
* 5 4 (NAME "outbox" MIMETYPE (message/rfc822 inode/directory) REMOTEID
"outbox" REMOTEREVISION "0" RESOURCE "akonadi_maildir_resource_0" VIRTUAL 0
CACHEPOLICY (INHERIT true INTERVAL -1 CACHETIMEOUT 1 SYNCONDEMAND true
LOCALPARTS (ENVELOPE)) SpecialCollectionAttribute "outbox" ENTITYDISPLAY
"(\"caixa de saída\" \"mail-folder-outbox\" \"\" ())") 
* 10 4 (NAME "rascunhos" MIMETYPE (message/rfc822 inode/directory) REMOTEID
"rascunhos" REMOTEREVISION "0" RESOURCE "akonadi_maildir_resource_0" VIRTUAL 0
CACHEPOLICY (INHERIT true INTERVAL -1 CACHETIMEOUT 1 SYNCONDEMAND true
LOCALPARTS (ENVELOPE)) SpecialCollectionAttribute "drafts" ENTITYDISPLAY
"(\"rascunhos\" \"document-properties\" \"\" ())") 
* 4 0 (NAME "Pastas locais" MIMETYPE (message/rfc822 inode/directory) REMOTEID
"/home/thiago/.local/share/local-mail" REMOTEREVISION "" RESOURCE
"akonadi_maildir_resource_0" VIRTUAL 0 CACHEPOLICY (INHERIT false INTERVAL -1
CACHETIMEOUT 1 SYNCONDEMAND true LOCALPARTS (ENVELOPE)) AccessRights "wcdC"
SpecialCollectionAttribute "local-mail" ENTITYDISPLAY "(\"Pastas locais\"
\"folder\" \"\" ())")

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Kdepim-bugs mailing list