EDIT: This method is not sufficient. See below for update!
I recently switched our mailserver from Gentoo and Courier-IMAP to CentOS 5.6 and Dovecot, which all went pretty smooth, until this weekend Dovecot wasn’t accepting logins anymore, and a quick look at the logs revealed the following:
May 30 09:06:17 mx1 dovecot: pipe() failed: Too many open files
May 30 09:06:17 mx1 dovecot: Temporary failure in creating login processes, slowing down for now
This is due to the standard max. open files limit of 1024, and was solved rather quickly by adding the following to /etc/security/limits.conf:
* soft nofile 8192 * hard nofile 63536
This increases the system-wide maximum of open files to a soft limit of 8192 files, and a hard limit of 63536 files. Restart Dovecot and verify the new limit is in effect with the following command:
cat /proc/`pidof dovecot`/limits |grep files
It should give the following output:
Max open files 8192 63536 files
It seems this method does not work as well as i thought it would. I found a better and much quicker/easier way to fix this. Just edit /etc/sysconfig/dovecot and change it to:
# Here you can specify your dovecot command line options.
# Increase max open files for dovecot process
ulimit -n 4096
Restart dovecot and you’re all set. Don’t forget to revert the changes to /etc/security/limits.conf if you altered this file.