Comment 4 for bug 322800

Revision history for this message
gcc (chris+ubuntu-qwirx) wrote :

Something similar happens on Hardy Heron. Just found NSCD spinning on 100% CPU doing this:

[pid 5411] accept(9, 0, NULL) = -1 EMFILE (Too many open files)
[pid 5411] epoll_wait(10, {{EPOLLRDNORM, {u32=9, u64=9}}}, 100, 29988) = 1
[pid 5411] time(NULL) = 1234268027
[pid 5411] accept(9, 0, NULL) = -1 EMFILE (Too many open files)
[pid 5411] epoll_wait(10, {{EPOLLRDNORM, {u32=9, u64=9}}}, 100, 29988) = 1
[pid 5411] time(NULL) = 1234268027

Clearly if it gets an error from accept() it should at least log an error and wait a bit, not just spin in a tight loop.

The problem is that it has opened too many unix sockets:

nscd 5411 root 1018u unix 0xd97dee00 3767356 /var/run/nscd/socket
nscd 5411 root 1019u unix 0xd976d600 3767367 /var/run/nscd/socket
nscd 5411 root 1020u unix 0xf4187e00 3767369 /var/run/nscd/socket
nscd 5411 root 1021u unix 0xd97de200 3767375 /var/run/nscd/socket
nscd 5411 root 1022u unix 0xf70dc000 3767438 /var/run/nscd/socket
nscd 5411 root 1023u unix 0xd9508e00 3767440 /var/run/nscd/socket

There are 33 threads running at the moment according to /proc/5411/task, so there must be a file descriptor leak somewhere in nscd.

chris@fen-ndiyo3(~)$ lsb_release -rd
Description: Ubuntu 8.04.2
Release: 8.04

ii nscd 2.7-10ubuntu4 GNU C Library: Name Service Cache Daemon
ii libnss-ldap 258-1ubuntu3 NSS module for using LDAP as a naming servic