Too many open files

Rob McMahon Rob.McMahon at warwick.ac.uk
Tue Nov 4 07:39:18 EST 2008


Shelley Waltz wrote:
> Oddly enough I had the identical issue today while trying to remove a
> bunch of users.  I am running cyrus-imapd-2.3.7-2.el5 on RHEL5.
>
> I used cyradm and did
> sam user.x anyone c
> dm user.x
>
> This worked fine for about 20 users, then I got the following in maillog ...
>
> Nov  3 10:35:28 rr imap[16539]: IOERROR: opening quota file
> /var/lib/imap/quota/x/user.x: Too many open files
> Nov  3 10:35:28 rr imap[16539]: DBERROR: error fetching user.x: cyrusdb error
> Nov  3 10:35:28 rr imap[16539]: Deleted mailbox user.x
>
> If I look in /var/spool/imap/x/user/  the directory and folders for user
> x are still there.  If I try to remove the mailbox once again using
> cyradm, it claims the mailbox does not exist.
>
> How does one resolve this issue safely?
>
>   
I have the same problem with a few mailboxes myself, and don't know how 
to clean it up.

To avoid the problem in the first place, if you have just a few (tens ? 
couple of hundred) users beginning with the same prefix, I think you can 
avoid the problem in the first place by putting e.g.

  imap          cmd="imapd" listen="imap" prefork=0 maxfds=4096

in /etc/cyrus.conf.

I suspect the underlying cause is this chunk from 
lib/cyrusdb_quotalegacy.c(foreach):

    /* strip off the qr specific path and replace with pattern */
    sprintf(strstr(quota_path, FNAME_QUOTADIR) + strlen(FNAME_QUOTADIR),
            "?/%s*", prefix);

    /* search for the quotaroots */
    glob(quota_path, GLOB_NOSORT, NULL, &globbuf);

That pattern on our boxes can match thousands of users.  I think it 
needs to be more careful and go looking for `prefix' and `prefix.*', but 
I haven't dug into it far enough yet.

Cheers,

Rob

-- 
E-Mail:	Rob.McMahon at warwick.ac.uk		PHONE:  +44 24 7652 3037
Rob McMahon, IT Services, Warwick University, Coventry, CV4 7AL, England



More information about the Info-cyrus mailing list