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

Re: (ITS#3855) recovery from EBADF error for slapd

ITS#3400 was supposed to correct the counter, so that the limit of 16 
tries gets detected and then slapd shuts down. Do you have a test case 
to reproduce the EBADF situation in the first place, that demonstrates 
that the patch for ITS#3400 is still broken? (Note that the fix of 
ITS#3400 is part of 2.2.19.)

The patch looks interesting; probably it should break out of the loop 
after it detects a single bad descriptor. (It is already pretty rare to 
have one bad descriptor, what's the likelihood of more than one?)

I haven't looked closely at the code yet, does it work with outbound 
connections too (e.g. syncrepl consumer)?

jtownsend@opendarwin.org wrote:
> 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.
> http://www.opendarwin.org/~jtownsend/patches/ebadf/servers-slapd.patch
> .

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support