[Date Prev][Date Next] [Chronological] [Thread] [Top]

(ITS#5363) ldapsearch hangs when using ldap for host in nsswitch

Full_Name: Russ Allbery
Version: 2.4.7
OS: Debian GNU/Linux
Submission from: (NULL) (

ldapsearch calls getaddrinfo inside a mutex because on many systems it's not
thread-safe.  However, this means that if libnss-ldap is in use and pointing to
LDAP for host information, we get deadlock.  ldapsearch calls getaddrinfo(),
which calls into libnss-ldap, which tries to open a connection, which then hits
the same lock inside the LDAP libraries.

Not sure the best fix for this.  Removing the locks fixes the deadlock and is
safe for glibc systems since glibc's getaddrinfo is thread-safe; however, it
would not be safe on those other systems that prompted the lock in the first

See http://bugs.debian.org/340601 for reference including the patch that appears
to clear the deadlock on Debian that Steve came up with while tracking the
problem down.  I'm guessing that you don't want it in its current form, but it
may be useful for reference.