February 2008
The LDAP daemon slapd (ancient version 2.2.23) and slapcat share 90% CPU between themselves on a machine I want to use for other tasks too.
My colleague Heiko says that with a version this old, this may be caused by calling slapcat while slapd is running. Slapcat will try to access the database directly instead of using the LDAP protocol, and two processes accessing the same BDB backend simultaneously is more than the backend can handle.
So I kill slapcat, kill slapd, restart the slapd daemon.
Now the slapd daemon takes nearly 100% CPU, and strace shows that it spends all that time on the “sched_yield” call.
This, according to many sources on the web, is caused by a corrupt backend, which can be mended by cd'ing to /var/lib/ldap/
and running db4.2_recover without parameters.
This works: slapd can now be started, and takes acceptable toll on the CPU.
databasename