The issue manifests itself when using db_verify on OpenLDAP database.
1.
mv /etc/openldap/slapd.d /etc/openldap/slapd.d.backup
2.
cp /usr/share/openldap-servers/slapd.conf.obsolete /etc/openldap/
mv /etc/openldap/slapd.conf.obsolete /etc/openldap/slapd.conf
3.
cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/
mv /var/lib/ldap/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
4.
vi /etc/openldap/slapd.conf
---
#######################################################################
# database definitions
#######################################################################
database bdb
suffix "dc=my-domain,dc=com"
checkpoint 1024 15
rootdn "cn=Manager,dc=my-domain,dc=com"
# Cleartext passwords, especially for the rootdn, should
# be avoided. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
# rootpw secret
|
v Change
rootpw secret
---
5.
service slapd start
6.
vi /tmp/test.ldif
---
dn: dc=my-domain,dc=com
objectClass: dcObject
objectClass: organization
o: my-domain
dc: my-domain
dn: cn=Manager,dc=my-domain,dc=com
objectClass: organizationalRole
cn: Manager
dn: ou=People,dc=my-domain,dc=com
objectClass: organizationalUnit
ou: People
dn: ou=Group,dc=my-domain,dc=com
objectClass: organizationalUnit
ou: Group
dn: ou=Address,dc=my-domain,dc=com
objectClass: organizationalUnit
ou: Address
dn: cn=system,ou=Group,dc=my-domain,dc=com
objectClass: posixGroup
objectClass: top
cn: system
gidNumber: 1000
dn: uid=1000001,ou=People,dc=my-domain,dc=com
objectClass: shadowAccount
objectClass: posixAccount
objectClass: account
objectClass: top
cn: 1000001
uid: 1000001
uidNumber: 1000001
gidNumber: 1000
homeDirectory: /home/1000001
loginShell: /bin/bash
shadowMin: 0
shadowMax: 99999
shadowWarning: 7
shadowLastChange: 16175
userPassword: secret
---
7.
ldapadd -x -D "cn=Manager,dc=my-domain,dc=com" -w secret -f /tmp/test.ldif
8.
service slapd stop
9.
cd /var/lib/ldap
10.
slapcat
11.
db_stat -h . -x
Confirm "Mutex free count".
12.
for i in {1..100} ; do db_verify -h . `ls *.bdb` ; done
Confirm messages.
---
db_verify: unable to allocate memory for mutex; resize mutex region
db_verify: cn.bdb: Cannot allocate memory
--
13.
db_stat -h . -x
Confirm "Mutex free count".
14.
slapcat
Confirm messages.
---
bdb(dc=my-domain,dc=com): unable to allocate memory for mutex; resize mutex region
bdb_db_open: database "dc=my-domain,dc=com" cannot be opened, err 12. Restore from backup!
---