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

RE: Database deadlock when adding new entry



Hi Aleksandar,

On Tuesday, June 20, 2006, Aleksandar Milivojevic wrote:
> I'm experiencing database deadlocks when adding new entry into the
> directory.  In short, all works fine for some time, than I attempt to
> add new entry into the directory, and LDAP server (slapd) simply
> hangs.  

Most likely there are locks left over in the database from a previous system
crash, or a segfault or unexpected shutdown (i.e., kill -9) of slapd. In the
release you are talking about there were no mechanisms available to
automatically clean up leftover database locks after such an event. You can
manually recover from this situation using the following procedure BEFORE
starting slapd:

cd <db_data_directory>     # this is the directory with *.bdb files in it. 
<path_to_db4_utilities>/db_recover # Make sure the version matches! 

This will replay any transactions that were not recorded, roll back any that
were not committed, and release any locks that may have been held. See the
db_recover man page for additional information. Starting with OpenLDAP 2.3
this is done automatically at startup if needed.

I should point out (as others will) that OpenLDAP 2.2 has been designated
"Historic", meaning you're on your own if you insist on using it. Also,
there are much better OpenLDAP releases than 2.2.13. If "free" is your
concern, go get CDS Silver (http://www.symas.com). You will have your choice
of distributions of OpenLDAP 2.2 (CDS 2) or OpenLDAP 2.3 (CDS 3). The CDS 2
download area contains OpenLDAP distributions built from the last and most
stable packaged binaries in the OpenLDAP 2.2 stream. These OpenLDAP 2.2
binaries also contain the db auto-recovery code Symas introduced in OpenLDAP
2.3, but as Quanah points out syncrepl is experimental in that release. If
you're married to OpenLDAP 2.2 it's best to use slurpd for replication.

Hope this helps,

Matthew Hardin
Symas Corporation
Packaged, certified, and supported LDAP solutions powered by OpenLDAP:
http://www.symas.com