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

slapd detach and listen order



Up through 2.4.26, slapd detached after binding server sockets
(slapd_daemon_init) but before initializing back ends (slap_startup)
or calling listen on the server sockets (slapd_daemon).  Since
initializing DB back ends could take some time, there were some
practical issues like
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=589915 .

The intended fix for this, 03ac02c7215fb592a75370b86069ee2372abec49
and f77e475967cb71ce925941b4660c4d7a04b3b8bf and
9f66f51a7189e6bf73ae6f2ff5da11487a94664e, cause the parent process to
wait until the child has finished running slap_startup().  But unless
I'm misreading the code, it seems like there is still a window after
the parent exits before the child calls listen on the server sockets,
during which a client could try to connect and fail.

Is there a reason why the call to listen needs to be deferred until
slapd_daemon_task, instead of doing it in slap_open_listener when the
server sockets are first bound?

(This issue came up for me because I'm writing automated tests for the
MIT krb5 LDAP KDB module.  I haven't been able to produce a failure to
connect after starting the 2.4.28 slapd, I think because the window is
very brief, but any window is likely to eventually cause an issue on
someone's machine, in my experience.)