9.5.0-P2 and socket: too many open file descriptors

JINMEI Tatuya / 神明達哉 Jinmei_Tatuya at isc.org
Wed Aug 13 21:42:24 UTC 2008


At Wed, 13 Aug 2008 12:28:23 -0700,
"David Sparks" <dave at ca.sophos.com> wrote:

> >> Usual question:
> >> - did you build named with a large value of FD_SETSIZE?
> 
> I just found out I have a similar problem with BIND 9.5.0-P2.  I have nofile 
> set to 8192 but it doesn't seem to be respected by named?  Why does named not 
> use the limits set by ulimit?  Distro binaries are seldom built with special 
> defines like this set.

Because the standard API of select() doesn't ensure it works for more
than FD_SETSIZE descriptors.  And even though we've seen reports about
'too many open FDs', the default maximum FD_SETSIZE should actually be
fine for vast majority of users.  If we implicitly raise the maximum,
possibly violating something of the system call interface, it may hurt
such innocent users.  So we thought the default should be
conservative.

Also, don't forget the world is not just Linux.  Solaris requires a
compile time change to FD_SETSIZE, so it's very difficult to increase
the limitation 100% run-time.

Nevertheless, we plan to introduce a command-line option for beta
versions to specify the named's internal limitation run-time.  This
would make more sense for beta because it can use newer APIs (such as
BSD kqueue and Linux epoll) that don't have a hard limitation like
FD_SETSIZE of select().

> I just tried bumping this up to 16384 by patching the Gentoo ebuild.  Compile 
> lines look like this so I assume that the define is properly set:
> 
>   x86_64-pc-linux-gnu-gcc 
> -I/var/tmp/portage/net-dns/bind-9.5.0_p2-r1/work/bind-9.5.0-P2 -I./include 
> -I./../nothreads/include
>   -I../include -I./../include -I./.. -DFD_SETSIZE=16384 -march=nocona -O2 
> -pipe -D_GNU_SOURCE -I/usr/include/libxml2 -W -Wall
>   -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith 
> -fno-strict-aliasing -c app.c  -fPIC -DPIC -o .libs/app.o
> 
> Apparently 16384 fd isn't sufficient?  I restarted named and:
> 
> 13-Aug-2008 12:04:55.667 general: error: socket: too many open file descriptors

Linux doesn't honor user defined FD_SETSIZE at compilation time
(welcome to the wonderful portability mess).  You should define
ISC_SOCKET_FDSETSIZE for Linux instead:

$ STD_CDEFINES="-DISC_SOCKET_FDSETSIZE=16384" ./configure
$ make

---
JINMEI, Tatuya
Internet Systems Consortium, Inc.


More information about the bind-users mailing list