Maintained by: NLnet Labs

[Unbound-users] FreeBSD + Unbound 1.0.2 error: too many file descriptors requested

Dmitriy Demidov
Fri Aug 8 20:43:09 CEST 2008


Hello unbound-users!

I'm runing unbound-1.0.2 installed from ports, under FreeBSD 7.0 
Unbound is installed without libevent. Yesterday I have done portupgade from 
unbound-1.0.1 to unbound-1.0.2

Now I met the following problem - Unbound do not starts. I found the reasone - 
it is because of value of num-threads set. Old Unbound 1.0.1 configuration 
has been set to use num-threads: 8 , but Unbound 1.0.2 can be started only 
with setting num-threads: to 3 or less. 

When I try to start Unbound with num-threads: 4 or more, unbound says to me 
that:

# /usr/local/etc/rc.d/unbound start
Starting unbound.
[1218219064] unbound[3358:0] error: too many file descriptors requested. The 
builtinmini-event cannot handle more than 1024. Config for less fds or 
compile with libevent
[1218219064] unbound[3358:0] fatal error: configuration needs too many file 
descriptors

---

My system is configured this way:

ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) 524288
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 20095
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 65536
cpu time               (seconds, -t) unlimited
max user processes              (-u) 5547
virtual memory          (kbytes, -v) unlimited

---

My unbound.conf:

server:
        verbosity: 0
        #statistics-interval: 3600
        #num-threads: 8
        num-threads: 3
        interface: 0.0.0.0
        port: 53
        outgoing-range: 256
        msg-cache-size: 16m
        msg-cache-slabs: 4
        num-queries-per-thread: 1024
        rrset-cache-size: 32m
        rrset-cache-slabs: 4
        cache-max-ttl: 86400
        infra-host-ttl: 900
        infra-lame-ttl: 900
        infra-cache-slabs: 4
        infra-cache-numhosts: 10000
        infra-cache-lame-size: 10k
        do-ip4: yes
        do-ip6: no
        do-udp: yes
        do-tcp: yes
        do-daemonize: yes

        access-control: 0.0.0.0/0 refuse
        access-control: 127.0.0.0/8 allow
        access-control: ::0/0 refuse
        access-control: ::1 allow
        access-control: ::ffff:127.0.0.1 allow

        chroot: "/usr/local/etc/unbound"
        username: "unbound"
        directory: "/usr/local/etc/unbound"
        #logfile: "/usr/local/etc/unbound/unbound.log"
        logfile: ""
        use-syslog: no
        pidfile: "/usr/local/etc/unbound/unbound.pid"
        root-hints: "/usr/local/etc/unbound/named.cache"

        identity: "DNS"
        version: "1.0"
        hide-identity: yes
        hide-version: yes
        harden-glue: yes
        do-not-query-address: 127.0.0.1/8
        do-not-query-address: ::1
        do-not-query-localhost: yes
        module-config: "iterator"

---

AFAIK my unbound configuration with num-threads: 4 will requests only 256x4 = 
1024 file descriptors + 20 for TCP. In the same time there is system wide 
ilimit for 20095 file descriptors...

Do this behaviour is because of hard coded threshold in Unbound? 
If file descriptors count is >= 1024 and no libevent is used, then Unbound 
will stops with this error message?


You see, right now, under FreeBSD there is only libevent 1.3e available in 
ports, and I do not want to use it because of problems that it produced to me 
before... :(  I have a negative experience with Unbound 1.0 and libevent 
1.3e, so I do not want to use it. This libevent version makes Unbound 
unstable.