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

(ITS#7364) mdb: clean up POSIX semaphores on environment close.



Full_Name: Chris Mikkelson
Version: 2.4.32
OS: FreeBSD
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (204.147.85.37)


When a back-mdb database is closed, the POSIX semaphores created when the mdb
database was opened are left behind. This prevents a different user from opening
the database.

For example, if you run slapd as an unprivileged user, stop slapd, and do an
offline slapcat as root, slapd will not start up again as that unprivileged
user. The only ways to recover I've found are:

a) reboot the machine
b) restore the database from the slapcat, ensuring that slapadd runs as the
correct user, or
c) write a small program to re-generate the semaphore names an remove them.

The patch at:

http://mikk.net/~chris/patches/0002-Remove-POSIX-semaphores-when-the-last-user-closes-th.patch

Attempts to upgrade the lockfile lock to exclusive when closing the environment.
If that upgrade succeeds, it removes the semaphores.

Patch has been tested on a BSD system. WIN32 has not been tested.