[Bug 207804] nscd negtive cache do not timeout for getaddrinfo:Non -recoverable failure in name resolution

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Mar 8 12:00:56 UTC 2016


            Bug ID: 207804
           Summary: nscd negtive cache do not timeout for getaddrinfo:Non
                    -recoverable failure in name resolution
           Product: Base System
           Version: 10.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: amutu at amutu.com

I met this bug several times for the last years,today I can reproduce it on a
machine.I can always restart nscd or use nscd -i hosts to clear the nscd
cache,but I think it is better to fix this bug.


cat /etc/nsswitch.conf 
group: compat
group_compat: nis
hosts: cache files dns
networks: files
passwd: compat
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files

cat /etc/nscd.conf
threads 1
enable-cache passwd yes
enable-cache group yes
enable-cache hosts yes
enable-cache services yes
enable-cache protocols yes
enable-cache rpc yes
enable-cache networks yes

positive-time-to-live hosts 30
negative-time-to-live hosts 1

on the first console :
>pkg install bash postgresql95-client
>while true; do psql -p 80 -h www.google.com; sleep 50; done

you will see
psql: received invalid response to SSL...

on the second console:
edit the /etc/resolv.conf,comment all the nameserver using "#'

now on the first console,you will see:
psql: could not translate host name "www.google.com" to address: hostname nor
servname provided,or not known
psql: could not translate host name "www.google.com" to address: Non
-recoverable failure in name resolution
...............repeate the last message.........
you can ping www.google.com,but psql can not resolve the error.I read the psql
code,and find it use getaddrinfo to resolve the addr.

now even if you un-comment the servername in /etc/resolv.conf ,the  "Non
-recoverable failure in name resolution" still there,unless you restart nscd,or
nscd -i hosts for that user.

uname -a
FreeBSD xx 10.1-RELEASE-p26 FreeBSD 10.1-RELEASE-p26 #0: Wed Jan 13 20:59:29
UTC 2016     root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC 

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-bugs mailing list