Bug 160968 - search in all (imap) folders leads to "too many open files" error
Summary: search in all (imap) folders leads to "too many open files" error
Alias: None
Product: kmail
Classification: Applications
Component: IMAP (show other bugs)
Version: 1.2.3
Platform: unspecified Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: kdepim bugs
Keywords: triaged
: 130175 175775 210774 (view as bug list)
Depends on:
Reported: 2008-04-18 10:40 UTC by bert
Modified: 2015-04-12 09:49 UTC (History)
10 users (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description bert 2008-04-18 10:40:22 UTC
Version:           1.2.3 (using 3.5.5, Debian Package 4:3.5.5a.dfsg.1-8etch1 (4.0))
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.18-6-686

Searching for messages with the "include subfolders" option selected quickly leads to dozens of error boxes warning about "too many open files."

This effectively makes it impossible to search for mail with kmail, unless I already know in which folder to search.

kmail may sometimes also crash when I try to stop such a search.

The mail folders in my set-up are on an IMAP server, with some 30 subfolders under the INBOX, each of which has a similar number of sub-subfolders. It looks as if kmail tries to search in all subfolders in parallel, by opening one file in the local cache of each of those folders.
Comment 1 Bram Schoenmakers 2008-04-18 23:48:56 UTC
Similar to bug 107279, only in your case KMail does not crash, right?
Comment 2 bert 2008-04-19 00:51:06 UTC
Bram Schoenmakers wrote:
[bugs.kde.org quoted mail]

Correct. Lots of error dialogs, but not necessarily a crash. After I 
close a few hundred pop-ups, kmail usually continues normally. 
("Usually" is a relative term: I don't make this mistake very often. :-) )
Comment 3 Martin Fitzpatrick 2009-04-04 03:20:45 UTC
Cannot reproduce on 4.2.2 (Kubuntu) (n.b. original report is for 3.x)
Comment 4 Michael Leupold 2009-04-04 14:25:04 UTC
I can't reproduce either using trunk r948809. Does this problem still happen for you?
Comment 5 Martin Koller 2009-08-31 22:14:29 UTC
*** Bug 130175 has been marked as a duplicate of this bug. ***
Comment 6 Martin Koller 2009-09-02 00:53:51 UTC
*** Bug 175775 has been marked as a duplicate of this bug. ***
Comment 7 Björn Ruberg 2010-01-16 23:51:55 UTC
In the duplicate bugs there are reports of this issue in KDE 4.2 too. I think running into  the "too many open files" problem is quite dependent on the system configuration. It should be checked when files are openend and when closed when searchign through them
Comment 8 Björn Ruberg 2010-03-06 21:56:21 UTC
*** Bug 210774 has been marked as a duplicate of this bug. ***
Comment 9 Kristian Rink 2010-05-26 14:17:38 UTC
Seen this on kmail in Kubuntu 10.04. Adding to that, it seems that kmail in this environment tries to traverse all possible namespaces of the IMAP server (INBOX, user. , as well as global / shared folders) and list virtually any folder the user is allowed to access. The error messages pop up as soon as I start kmail and even try accessing the account in question, basically rendering kmail unusable for me right now. Generally, I wonder whether it is desirable to have the MUA initially scan the whole IMAP tree for available folders as (given a large server environment) this definitely will show things down initially and permanently (checking for new mail in these folders) while leaving the user lost amongst a vast load of folders (s)he doesn't know / care about... Limiting the folders visible by default to a smaller selection (INBOX only?) would eventually eliminate this problem as well...
Comment 10 kmail-bugs 2013-11-09 14:21:01 UTC
Using Kmail from Debian Wheezy (kmail_4%3a4.4.11.1+l10n-3+b1_amd64.deb) and a directory structure as shown below (17.2 GBytes in about 600 files and directories) this problem bites so badly that Kmail is quite unusable.

mail4:/home/xxxx_xxxxx# >>> du -s *
44      Accounts
335460  AM
4       Archives
4       Calcs
347248  Calculations
6688    Citation
2741192 Clients
4       XX2976
4       complaints
4       Customers
9166128 DESIGN
28288   Drafts
16428   Insurance
1152    Invoicing
4       Junk
12      mail
1700    Misc
1064    PC
1023740 QA
4       Rejections
506976  Rxxxxxxxxxxx
78316   Rubbish
112720  Sent
4       Supplier Rejections
2644428 Suppliers
6732    Temp
4       Test Certs
167832  Trash

I gave up with Kmail and replaced it with 'Evolution', which works fine with the same mail store.
Comment 11 Laurent Montel 2015-04-12 09:49:33 UTC
Thank you for taking the time to file a bug report.

KMail2 was released in 2011, and the entire code base went through significant changes. We are currently in the process of porting to Qt5 and KF5. It is unlikely that these bugs are still valid in KMail2.

We welcome you to try out KMail 2 with the KDE 4.14 release and give your feedback.