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

(ITS#3855) recovery from EBADF error for slapd

Full_Name: Jason Townsend
Version: 2.2.19, HEAD
OS: Mac OS X 10.4.1
URL: http://www.opendarwin.org/~jtownsend/patches/ebadf/servers-slapd.patch
Submission from: (NULL) (

If slapd encounters an EBADF error in its main select loop in
servers/slapd/daemon.c, it simply ignores it and attempts the select with the
same set of file descriptors as before. It appears the intent was to quit slapd
after 16 of these errors occur, but in my experience it would cause slapd to go
into a 100% CPU usage spin since select returns immediately in the EBADF case
rather than blocking, and somehow 16 error limit was not triggered.

I've made a change which allows slapd to find which file descriptor is bad and
remove it from the list so it can recover from this case without needing to
quit. The patch was originally developed against 2.2.19, but I've merged it into
HEAD. It probably also could apply to 2.3.x. Note that I did not create a
version for the HAVE_WINSOCK case since I don't have a Windows development
system to test that on but hopefully a similar strategy could be used there.