[Dovecot] How do I increase the fd limit on OS X?
Hi All,
I just upgraded to the new 1.1rc5 from 1.0 that I had been using and it advised me to increase the file descriptor limit. I'm not sure how to do this. There is a command built into tcsh that allows me to do this called limit, but sudo limit 4224 doesn't work, and usually dovecot is started from the rc.local file if I recall right, and I'm not sure how to set this up from there. Any advice.
Thanks,
Rob
Rob Frohne <rob.frohne@wallawalla.edu> Walla Walla University
At 1:17 PM -0700 5/7/08, Rob Frohne imposed structure on a stream of electrons, yielding:
Hi All,
I just upgraded to the new 1.1rc5 from 1.0 that I had been using and it advised me to increase the file descriptor limit. I'm not sure how to do this. There is a command built into tcsh that allows me to do this called limit, but sudo limit 4224 doesn't work,
The tcsh builtin 'limit' only changes the limit for the currently running instance of tcsh and its children, so even if running a command via sudo ran a shell (it doesn't) and your root shell were tcsh (which it would not be on any recent MacOS X) the 'limit' command would only apply until that to that shell exited (i.e. microseconds)
Assuming that you are using MacOS X 10.3 or later, you should be able to fix your problem by putting these lines into /etc/sysctl.conf and rebooting:
kern.maxfiles=65534 kern.maxfilesperproc=8192
Note that those two numbers are not necessarily ideal for your system, but unless you are on a very small machine they should not cause trouble. You can set these on a live system with:
sudo sysctl -w kern.maxfiles=65534 kern.maxfilesperproc=8192
However, there's a reasonably good chance that Dovecot won't try to adjust to those limits changing at runtime, so you'll probably have to at least restart it. It is also possible that Dovecot does not itself even try to adjust the soft limit at startup time, which would mean that you would need to work with whatever starts it up to hand it a reasonable soft limit. See below...
and usually dovecot is started from the rc.local file if I recall right, and I'm not sure how to set this up from there. Any advice.
In fact it is a bit unusual to find a rc.local script on a MacOS machine, because MacOS uses its own unique system startup and daemon control mechanisms. Not that rc.local does not work, it just doesn't usually exist because of the slicker ways to start things. The older "SystemStarter" system uses structured subdirectories under /Library/StartupItems for add-on software like Dovecot, while the newer "launchd" uses parameter lists in /Library/LaunchDaemons/.
How Dovecot is started on your system, which is both a function of version and of how Dovecot was originally set up, determines how you would set the soft limit it is started with. If you are actually using rc.local or SystemStarter, the startup is being done through a shell (sh, NOT tcsh) script, and the line you'd need to add (either to /etc/rc.local or /Library/StartupItems/Dovecot/Dovecot) ahead of the start of Dovecot is:
ulimit -n 4224
If you are running Tiger or Leopard, you are likely to be using launchd, have a plist that looks a bit like the one at http://wiki.dovecot.org/LaunchdInstall, and you will need to add a new key as a member of the overall <dict> structure:
<key>SoftResourceLimits</key> <dict> <key>NumberOfFiles</key> <integer>4224</integer> </dict>
That plist file will be in /Library/LaunchDaemons and should be named dovecot.plist, org.dovecot.plist, or (strictly matching the Apple naming convention and looking goofy) org.dovecot.dovecot.plist.
-- Bill Cole bill@scconsult.com
participants (2)
-
Bill Cole
-
Rob Frohne