Skip to Main Content

Berkeley DB Family

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Please ask technical questions in the appropriate category. Thank you!

Mutex leak in db_verify

jstanekMar 1 2016 — edited Jun 7 2016

Hello again,

continuing the issue from https://community.oracle.com/message/13366172#13366172, we are now able to reproduce it on actual database (the last time, I mistook the regional files for the entire DB and my reproduces was thus invalid).

The issue manifests itself when using db_verify on OpenLDAP database.

Versions: BerkeleyDB 4.7.25, OpenLDAP server 2.4.40, RHEL 6.5

Reproducer:

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!

---

Files used for testing (after triggering the issue, with 0 mutexes left): https://jstanek.fedorapeople.org/db_verify-database.tar.xz

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 5 2016
Added on Mar 1 2016
8 comments
2,139 views