sysctl maxfiles

Aristedes Maniatis ari at
Sat Sep 27 22:29:22 UTC 2008

On 28/09/2008, at 8:18 AM, Gary Palmer wrote:

> At least one port recommends you set
> kern.maxfiles="40000"
> in /boot/loader.conf.  I think its one of the GNOME ports.  I'm pretty
> confident you can run that without too many problems, and maybe go  
> higher,
> but if you really want to know the limit its probably kernel memory  
> and
> that will depend on your workload.

I guess then I should ask the question a different way. How much  
memory does each fd use and which pool of memory does it come from?  
This is ZFS if that makes any difference.

Or asked a different way, if I set the number to 200,000 and some  
rogue process used 190,000 fds, then what bad thing would happen to  
the system? If any.

> Solving the fd leak is by far the safest path.  Note that tracking
> that many files is probably affecting your application performance
> in addition to hurting the system.

Absolutely. We are working on it. But general Unix principles are that  
a non-root user should not be able to get Unix to a non-functional  
state. It appears that this is a very simple path to DoS, particularly  
since with the default settings it is easy for one process to use up  
all available fds and leave no more for anyone to be able to log in.

Ari Maniatis

Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001   fax +61 2 9550 4001
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

More information about the freebsd-stable mailing list