Dovecot and the “Too many open files” error

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

UPDATE:

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.
#
#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.

  1. Dovecot e il problema “Too many open files” | gabcicala - pingback on July 1, 2011 at 12:57 pm

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackbacks and Pingbacks: