IMAPD-SSL - too many open files

keithw--- via courier-users <[email protected]> Tue, 27 May 2025 13:57:31 -0500
Newsgroups gmane.mail.imap.courier.general
Message-ID <[email protected]>
Hi Team,

I have a strange issue.  I have a new Centos 10 VM built and compiled 
with the latest version of Courier and all the tools.

Thank you in advance for any assistance you can provide.

The server is running great.  There are over 1000 accounts on it.

After about an hour or two, I start getting this in the logs and then 
IMAP stops working for everyone.

May 20 01:02:45 smtp imapd-ssl[9428]: .: Too many open files
May 20 01:02:45 smtp imapd-ssl[9428]: This may be a problem with FAM or 
Gamin
May 20 01:02:45 smtp imapd-ssl[9428]: Failed to create cache file: 
maildirwatch ([email protected])
May 20 01:02:45 smtp imapd-ssl[9428]: Error: Too many open files
May 20 01:02:45 smtp imapd-ssl[9428]: Failed to create cache file: 
maildirwatch ([email protected])
May 20 01:02:45 smtp imapd-ssl[9428]: Error: Too many open files

May 20 01:02:51 smtp imapd-ssl[9428]: .: Too many open files
May 20 01:02:51 smtp imapd-ssl[9428]: This may be a problem with FAM or 
Gamin
May 20 01:02:51 smtp imapd-ssl[9428]: Failed to create cache file: 
maildirwatch ([email protected])
May 20 01:02:51 smtp imapd-ssl[9428]: Error: Too many open files

A simple restart of courier and the problem is gone.

Currently I have a crontab restarting courier hourly and generally it 
gets us by, but sometimes it doesn't.

Here are some relevant info on open file ulimits.

root@smtp:/etc/courier# cat /proc/sys/fs/file-max
9223372036854775807

root@smtp:/etc/courier# cat /proc/sys/fs/file-nr
6752    0       9223372036854775807

root@smtp:/etc/courier# runuser -u vmail -- sh -c 'ulimit -a'
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) 0
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 126925
max locked memory           (kbytes, -l) 8192
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 8192
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 126925
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited

I have a feeling the message is wrong and this is some sort of leak.  
Looking for any direction.

Config files:

#/etc/courier/imapd

ADDRESS=0
PORT=143
MAXDAEMONS="500"
MAXPERIP="500"
PIDFILE=/var/spool/courier/tmp/imapd.pid
TCPDOPTS="-nodnslookup"
IMAPACCESSFILE=/etc/courier/imapaccess
LOGGEROPTS="-name=imapd"
IMAP_CAPABILITY="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE 
THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 
AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE"
IMAP_KEYWORDS=1
IMAP_ACL=1
IMAP_CAPABILITY_ORIG="IMAP4rev1 UIDPLUS CHILDREN NAMESPACE 
THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA AUTH=CRAM-MD5 
AUTH=CRAM-SHA1 AUTH=CRAM-SHA256 IDLE"
IMAP_PROXY=0
IMAP_PROXY_FOREIGN=0
IMAP_IDLE_TIMEOUT=60
IMAP_MAILBOX_SANITY_CHECK=1
IMAP_CAPABILITY_TLS="$IMAP_CAPABILITY AUTH=PLAIN"
IMAP_CAPABILITY_TLS_ORIG="$IMAP_CAPABILITY_ORIG AUTH=PLAIN"
IMAP_DISABLETHREADSORT=0
IMAP_CHECK_ALL_FOLDERS=0
IMAP_OBSOLETE_CLIENT=0
IMAP_UMASK=022
IMAP_ULIMITD="65536"
IMAP_USELOCKS="1"
IMAP_SHAREDINDEXFILE=/etc/courier/shared/index
IMAP_TRASHFOLDERNAME=Trash
IMAP_EMPTYTRASH="Trash:7"
IMAP_MOVE_EXPUNGE_TO_TRASH="1"
DEBUG_LOGIN=2
SENDMAIL=/usr/lib/courier/bin/sendmail
HEADERFROM=X-IMAP-Sender
IMAPDSTART="YES"
MAILDIRPATH=Maildir

#/etc/courier/imapd-ssl

SSLPORT=993
SSLADDRESS=0
SSLPIDFILE=/var/spool/courier/tmp/imapd-ssl.pid
SSLLOGGEROPTS="-name=imapd-ssl"
IMAPDSSLSTART="YES"
IMAPDSTARTTLS="YES"
IMAP_TLS_REQUIRED="0"
TLS_VERBOSE=1
COURIERTLS=/usr/lib/courier/bin/couriertls
TLS_CERTFILE=/usr/lib/courier/share/imapd.pem
TLS_DHPARAMS=/usr/lib/courier/share/dhparams.pem
TLS_TRUSTCERTS=/etc/ssl/cert.pem
TLS_VERIFYPEER=NONE
TLS_CACHEFILE=/var/spool/courier/couriersslimapcache
TLS_CACHESIZE=524288
TLS_ALPN=imap
MAILDIRPATH=Maildir

Thank you for any troubleshooting advice!
 


_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users