Bug 322958 - KMail: duplicate special folder causes endless loop "Emitting defaultFoldersChanged"
Summary: KMail: duplicate special folder causes endless loop "Emitting defaultFoldersC...
Alias: None
Product: kmail2
Classification: Applications
Component: general (show other bugs)
Version: 4.11 rc2
Platform: openSUSE Linux
: NOR critical
Target Milestone: ---
Assignee: kdepim bugs
: 323740 326089 (view as bug list)
Depends on:
Reported: 2013-07-29 18:42 UTC by Christian Boltz
Modified: 2015-09-11 12:08 UTC (History)
14 users (show)

See Also:
Latest Commit:
Version Fixed In:

Log of Kontact startup (and subsequent kill). (69.65 KB, text/plain)
2013-09-24 12:53 UTC, Diego

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Boltz 2013-07-29 18:42:45 UTC
(also reported as https://bugzilla.novell.com/show_bug.cgi?id=830661 )

I'm using openSUSE Factory + KDE:Distro:Factory repo (contains KDE 4.10.97 = 4.11 rc2). The symptoms first appeared a week ago with openSUSE Factory and KDE 4.10.90.

KMail is unuseable because:
- kmail, akonadiserver and mysql eat up my cpu 
- kmail takes ages to display a mail (more than a minute) 
  (the list of mails in a folder is displayed quickly when changing folders)
- it's impossible to send a mail - the composer window stays open (greyed out) forever, but the mail isn't sent (I killed kmail after maybe 10 minutes)

In other words: KMail from KDE 4.10.9x is completely unuseable on my system :-( - I have to use webmail for now.

This happens with an existing user, with some GB of mails.
(With a new test user, KMail doesn't eat up the CPU - but the test user does
not have any mails.)

After enabling debugging, kmail prints the following lines in the konsole in an endless loop:

kmail2(8128)/libakonadi Akonadi::SpecialCollectionsPrivate::emitChanged: Emitting defaultFoldersChanged.
kmail2(8128)/libakonadi Akonadi::SpecialCollectionsPrivate::emitChanged: Emitting changed for "akonadi_maildir_resource_1"

Any ideas how to get a useable KMail again are more than welcome ;-)

Reproducible: Always

Steps to Reproduce:
1. start KMail on my system (yes, I know this isn't very helpful - sorry for that ;-)
Comment 1 Poborskiii 2013-08-03 18:33:54 UTC
Same problem on Kubuntu 13.04 after upgrade to KDE 4.10 beta1 (still with rc2). I have only about 1 000 mails, but same symptoms plus memory leak: after a hours kmail is taking whole RAM and Kubuntu gets frozen. Closing is posible only with kill. After clicking on mail is in mail window displayed (in Czech) "Stahuje se obsah složky. Prosím čekejte . . ." (aka Downloading folder content. Please wait...). Sometimes it is waiting for minutes, but usually endlessly.
Comment 2 Poborskiii 2013-08-03 19:13:38 UTC
Sorry, ... after upgrade to KDE 4.11 beta1... , not 4.10 ;-)
Comment 3 Sergio Martins 2013-08-04 11:45:34 UTC
Can anyone build from source and test some patches ?
Comment 4 Christian Boltz 2013-08-05 12:19:28 UTC
quoting from IRC:
[23:45:01] <dvratil> there was a bugfix on July 27 that maybe could solve your problem

(that means _after_ 4.11 RC2)

A July 28 snapshot at least gave me a different set of error messages ;-)

After some more debugging on IRC (thanks dvratil and montel!) we found out that I had (for some unknown reason) two outbox folders. Deleting one of them solved the problem for me.

Short howto:
- start akonadiconsole
- go to the "browser" tab
- check that you have only one inbox, outbox etc. folder - if you have more than one, delete the duplicate (if it contains mails, move them away first)

@Poborskiii: Does updating to a newer snapshot and/or removing duplicate folders solve your problem?
Comment 5 Poborskiii 2013-08-08 19:27:19 UTC
Yes, deletion of duplicate folders solved my problem. Many thanks!
Comment 6 Christian Boltz 2013-08-18 19:08:24 UTC
There was another report of duplicate outbox on the opensuse-de mailinglist.
The workaround from comment #4 helped, but additionally logging out and in was needed (I'd guess restarting akonadi and kmail would have been enough).
Comment 7 Rolf Eike Beer 2013-08-20 17:13:50 UTC
*** Bug 323740 has been marked as a duplicate of this bug. ***
Comment 8 Frederik Gladhorn 2013-08-21 14:53:03 UTC
Seeing that there were several people that got this bug fixed by removing duplicate special folders it would be a good idea to investigate

a) what causes creation of duplicate special folders 
b) how to not go crazy if there are duplicates
Comment 9 Alexander Stein 2013-08-21 18:00:29 UTC
I've been hit by the same problem. I got 3 duplicates: inbox, outbox, sent-mail each in "pure" german language. When I started LANG=C kmail I could distinguish them without problem.
But it would be nice to know how to delete those directories without waiting for ages in kmail for processing of each deletion job. Something in command line maybe?
Comment 10 Rolf Eike Beer 2013-08-21 18:20:29 UTC
You can easily delete them using akonadiconsole.
Comment 11 Diego 2013-09-24 12:53:00 UTC
Created attachment 82474 [details]
Log of Kontact startup (and subsequent kill).

Log of Kontact repeating:
kontact(13657) MailCommon::Kernel::initFolders: Initialized and looking for specialcollection folders.

JobTracker reports lots of CollectionFetchJob for collection 0.
Comment 12 Diego 2013-09-24 13:35:39 UTC
For reference, this is what I found about the duplicates:
[15:00] <panda84kde> dvratil: I see. I have two copies of "inbox", two of "outbox" and two of "sent-mail", however one is in english, the other one is localized in italian (my language)
[15:01] <dvratil> that sounds like a possible issue
[15:01] <panda84kde> so I have "inbox" and "in arrivo", "outbox" and "in uscita" and "sent-mail" and "inviata"
[15:01] <dvratil> do both versions contain the same emails?
[15:02] <panda84kde> I must say that I've changed language this morning to report english string, but usually I use italian
[15:03] <panda84kde> dvratil: the italian ones have no content "total = 0, size = 0B", the english ones have no description strings "total = , size = "
[15:04] <dvratil> ok, so I guess it's safe to pick one and delete it :)
[15:06] <panda84kde> dvratil: whohhhhhhhhhhhhhhhhhoaaaaaaaaaaaaa! (deleting italian folders worked)
[15:06] <dvratil> \o/
[15:07] * panda84kde tries reverting to italian to see what happens
[15:07] <dvratil> panda84kde, so this happened after you changed your KDE locales?
[15:07] <panda84kde> dvratil: I'm sorry. No. :(
[15:08] <dvratil> do you remember whether the folders were called english or italian before 4.11?
[15:08] <panda84kde> dvratil: I changed locale because I had the problem and I wanted to share the problem using strings in english
[15:09] <panda84kde> 99% italian
[15:10] <panda84kde> however, now they got *renamed* from english to their italian counterpart
[15:10] <dvratil> hmm, ok...still - sounds like this could be the trigger - I recall that someone had exactly the same problem - duplicates in local language
[15:10] <dvratil> migration issue?
[15:12] <panda84kde> my suspesct is somehow this: I had somehow weirdly named local folder, which got "fixed", though duplicated, moving to 4.11. Mind that i'm a Kontact user since something like 4.2
[15:13] <panda84kde> so probably I had something bad from the past.
[15:13] <dvratil> probably
[15:29] <panda84kde> dvratil: now I can change from italian to english and viceversa and the folders just get renamed.
[15:35] <panda84kde> dvratil: moreover I *had* messages in the inbox / sent-mail folders, but they wheren't listed. Now they are present in my folders (although while using Kontact in english I removed the italian folders)
Comment 13 Diego 2013-09-24 14:00:06 UTC
For anybody who might encounter this bug in the future it would be useful if, before deleting the duplicates they can note down and report here the informations reported in the "Attributes" and "Internals" tabs reachable this way:
- open Akonadi Console;
- go to the Browser tab;
- identify the duplicates in "KMail Folders"
Comment 14 Diego 2013-09-24 14:02:31 UTC
Submitted incomplete.

(In reply to comment #13)
> For anybody who might encounter this bug in the future it would be useful
> if, before deleting the duplicates they can note down and report here the
> informations reported in the "Attributes" and "Internals" tabs reachable
> this way:
> - open Akonadi Console;
> - go to the Browser tab;
> - identify the duplicates in "KMail Folders"

- right click one of the duplicate and select "Folder properties";
- report values for "Attributes" and "Internals";
- do the same for the other duplicate.
Comment 15 Lisandro Damián Nicanor Pérez Meyer 2013-09-24 14:13:31 UTC
Been hit by this too. In my case the duplicate folders came from an old pop-account backup. So there is no really *one* culprit here, there are many ways to trigger this bug.
Comment 16 Martin Steigerwald 2013-10-16 12:28:21 UTC
"Bug #326089 - accessing mail contents lags for minutes and then sending mail does as well" may be related to this one. At least the symptoms of those lags on accessing mail content or sending mail are same. But I didn´t find a whole bunch of duplicated folders.
Comment 17 Martin Steigerwald 2013-10-16 12:48:03 UTC
*** Bug 326089 has been marked as a duplicate of this bug. ***
Comment 18 Facundo Aguilera 2013-10-25 18:37:03 UTC
Same problem here. I never used POP and local folders are empty, only have IMAP acounts. I saw duplicate folders in akonadiconsole (just local folders) an deleted them, but it does not help, i.e. I still having the "accessing mail contents lags for minutes and then sending mail does as well" problem. Deleting the ~/.local/share/local-mail folder (it was recreated automatically)  solved my problem at least for now. The only difference I can see is that old folders names are in english, while new are in spanish.
Comment 19 Laurent Montel 2013-10-26 15:26:07 UTC
I think that I fixed this bug in 4.11.3 in code
but can't fix for existing installation.
Comment 20 Martin Steigerwald 2015-09-11 12:07:48 UTC
I didn´t see this in ages anymore. Also it is about a version of KMail that uses Nepomuk and is unmaintained. Thus closing. If it still happens, please reopen. Thanks, Martin