[Pkg-openldap-devel] Bug#465915: Bug#465915: segmentation fault in slapd under some load

Arthur de Jong adejong at debian.org
Fri Feb 15 22:19:23 UTC 2008


On Fri, 2008-02-15 at 10:57 -0800, Quanah Gibson-Mount wrote:
> This is most likely upstream bug ITS#5336.
> 
> It would be helpful to see the output in gdb of:
> 
> print *bdb
> 
> to see how the caches were configured.
> 
> For example, from ITS#5336, at frame 3, a print *bdb
> 
> would have been useful there.  If you can do something similarly in your 
> bug, that would be great.

This is basically what I get (full log attached):

# gdb /usr/sbin/slapd
[...]
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb5625b90 (LWP 25836)]
0xb7d0f160 in pthread_mutex_lock () from /lib/libpthread.so.0
(gdb) bt
#0  0xb7d0f160 in pthread_mutex_lock () from /lib/libpthread.so.0
#1  0xb7f6351d in ldap_pvt_thread_mutex_lock () from /usr/lib/libldap_r-2.4.so.2
#2  0xb784583d in bdb_cache_return_entry_rw (bdb=0x81e9cd0, e=0x8208c2c, rw=0, lock=0xb5623fd4)
    at /build/buildd/openldap2.3-2.4.7/servers/slapd/back-bdb/cache.c:256
#3  0xb7839e12 in bdb_search (op=0x8327b10, rs=0xb5625168)
    at /build/buildd/openldap2.3-2.4.7/servers/slapd/back-bdb/search.c:909
#4  0x08077d13 in fe_op_search (op=0x8327b10, rs=0xb5625168)
    at /build/buildd/openldap2.3-2.4.7/servers/slapd/search.c:368
#5  0x0807853c in do_search (op=0x8327b10, rs=0xb5625168)
    at /build/buildd/openldap2.3-2.4.7/servers/slapd/search.c:217
#6  0x080757c6 in connection_operation (ctx=0xb5625248, arg_v=0x8327b10)
    at /build/buildd/openldap2.3-2.4.7/servers/slapd/connection.c:1083
#7  0x08075ed6 in connection_read_thread (ctx=0xb5625248, argv=0x14)
    at /build/buildd/openldap2.3-2.4.7/servers/slapd/connection.c:1210
#8  0xb7f62a44 in ?? () from /usr/lib/libldap_r-2.4.so.2
#9  0xb5625248 in ?? ()
#10 0x00000014 in ?? ()
#11 0x00000000 in ?? ()
(gdb) frame 3
#3  0xb7839e12 in bdb_search (op=0x8327b10, rs=0xb5625168)
    at /build/buildd/openldap2.3-2.4.7/servers/slapd/back-bdb/search.c:909
909 /build/buildd/openldap2.3-2.4.7/servers/slapd/back-bdb/search.c: No such file or directory.
  in /build/buildd/openldap2.3-2.4.7/servers/slapd/back-bdb/search.c
(gdb) print *bdb
$1 = {bi_dbenv = 0x823baf8, bi_dbenv_home = 0x81e9fa8 "/var/lib/ldap", bi_dbenv_xflags = 0,
  bi_dbenv_mode = 384, bi_ndatabases = 3, bi_databases = 0x823c1c0, bi_database_mutex = {__data = {
      __lock = 0, __count = 0, __owner = 0, __kind = 0, __nusers = 0, {__spins = 0, __list = {
          __next = 0x0}}}, __size = '\0' <repeats 23 times>, __align = 0}, bi_db_opflags = 0,
  bi_defaultmask = 0, bi_cache = {c_eifree = 0x8241418, c_idtree = 0x83c1568, c_lruhead = 0x8271638,
    c_lrutail = 0x83c0c48, c_dntree = {bei_parent = 0x0, bei_id = 0, bei_lockpad = 0, bei_state = 128,
      bei_finders = 0, bei_nrdn = {bv_len = 0, bv_val = 0x0}, bei_e = 0x8244464, bei_kids = 0x823f3d8,
      bei_kids_mutex = {__data = {__lock = 0, __count = 0, __owner = 0, __kind = 0, __nusers = 0, {
            __spins = 0, __list = {__next = 0x0}}}, __size = '\0' <repeats 23 times>, __align = 0},
      bei_lrunext = 0x0, bei_lruprev = 0x0}, c_maxsize = 1000, c_cursize = 1003, c_minfree = 1,
    c_eimax = 2000, c_eiused = 2010, c_leaves = 2005, c_purging = 0, c_locker = 6, c_rwlock = {__data = {
        __lock = 0, __nr_readers = 0, __readers_wakeup = 58, __writer_wakeup = 14,
        __nr_readers_queued = 0, __nr_writers_queued = 0, __flags = 0 '\0', __shared = 0 '\0',
        __pad1 = 0 '\0', __pad2 = 0 '\0', __writer = 0},
      __size = "\000\000\000\000\000\000\000\000:\000\000\000\016", '\0' <repeats 18 times>, __align = 0},
    c_lru_mutex = {__data = {__lock = 0, __count = 0, __owner = 0, __kind = 0, __nusers = 0, {__spins = 0,
          __list = {__next = 0x0}}}, __size = '\0' <repeats 23 times>, __align = 0}, c_count_mutex = {
      __data = {__lock = 0, __count = 0, __owner = 0, __kind = 0, __nusers = 0, {__spins = 0, __list = {
            __next = 0x0}}}, __size = '\0' <repeats 23 times>, __align = 0}, c_eifree_mutex = {__data = {
        __lock = 0, __count = 0, __owner = 0, __kind = 0, __nusers = 0, {__spins = 0, __list = {
            __next = 0x0}}}, __size = '\0' <repeats 23 times>, __align = 0}}, bi_attrs = 0x81d0268,
  bi_nattrs = 1, bi_search_stack = 0x0, bi_search_stack_depth = 16, bi_linear_index = 0, bi_txn_cp = 1,
  bi_txn_cp_min = 30, bi_txn_cp_kbyte = 512, bi_txn_cp_task = 0x81e98d8, bi_index_task = 0x0,
  bi_lock_detect = 1, bi_shm_key = 0, bi_lastid = 2032, bi_lastid_mutex = {__data = {__lock = 0,
      __count = 0, __owner = 0, __kind = 0, __nusers = 0, {__spins = 0, __list = {__next = 0x0}}},
    __size = '\0' <repeats 23 times>, __align = 0}, bi_idl_cache_max_size = 0, bi_idl_cache_size = 0,
  bi_idl_tree = 0x0, bi_idl_lru_head = 0x0, bi_idl_lru_tail = 0x0, bi_idl_tree_rwlock = {__data = {
      __lock = 0, __nr_readers = 0, __readers_wakeup = 0, __writer_wakeup = 0, __nr_readers_queued = 0,
      __nr_writers_queued = 0, __flags = 0 '\0', __shared = 0 '\0', __pad1 = 0 '\0', __pad2 = 0 '\0',
      __writer = 0}, __size = '\0' <repeats 31 times>, __align = 0}, bi_idl_tree_lrulock = {__data = {
      __lock = 0, __count = 0, __owner = 0, __kind = 0, __nusers = 0, {__spins = 0, __list = {
          __next = 0x0}}}, __size = '\0' <repeats 23 times>, __align = 0}, bi_alock_info = {al_fd = 11,
    al_slot = 2}, bi_db_config_path = 0x81e9850 "/var/lib/ldap/DB_CONFIG", bi_db_config = 0x8230b48,
  bi_monitor = {bdm_cb = 0x0, bdm_ndn = {bv_len = 0, bv_val = 0x0}}, bi_flags = 3}

Hope this is any use (I'm not really a gdb hero so if you need more
details, please spell it out).

> Also, all the steps to reproduce this.

I don't have a very clean test case because I found this while testing
my own software. Anyway, this does it for me:

1. download and unpack
   http://ch.tudelft.nl/~arthur/nss-ldapd/nss-ldapd-0.6.tar.gz

2. compile:
   ./configure --enable-warnings --enable-debug
   make

3. set up slapd with earlier provided slapd.conf and attached LDIF file
   (tests expect slapd to listen on localhost but you can tune
   tests/nss-ldapd-test.conf)

4. run tests:
   make check

Output I'm getting (only test_myldap is significant):
[...]
PASS: test_tio
PASS: test_cfg
test_myldap.sh: using LDAP server ldap://127.0.0.1/
test_myldap: test_search(): getting session...
test_myldap: test_search(): doing search...
nslcd: DEBUG: myldap_search(base="dc=test,dc=tld", filter="(objectclass=posixaccount)")
nslcd: DEBUG: simple anonymous bind to ldap://127.0.0.1/
nslcd: connected to LDAP server ldap://127.0.0.1/
[...]
test_myldap: test_threads(): [worker 4] [9] DN uid=bbertao,ou=lotsofpeople,dc=test,dc=tld
test_myldap: test_threads(): [worker 4] ...
nslcd: ldap_result() failed: Can't contact LDAP server
nslcd: ldap_result() failed: Can't contact LDAP server
FAIL: test_myldap.sh

Please note that the test also includes some operations that should fail
(e.g. connecting to ldapi://%2fdev%2fnull/) but these can be disabled by
commenting out test_connections() in tests/test_myldap.c).

Btw, if by any chance you find any glaring errors in my code I'd like to
hear about it. I'm still not 100% comfortable with using OpenLDAP.

Thanks

-- 
-- arthur - adejong at debian.org - http://people.debian.org/~adejong --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.ldif.gz
Type: application/x-gzip
Size: 146182 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-openldap-devel/attachments/20080215/b1145820/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gdb-slapd-d273.txt.gz
Type: application/x-gzip
Size: 260732 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-openldap-devel/attachments/20080215/b1145820/attachment-0003.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-openldap-devel/attachments/20080215/b1145820/attachment-0001.pgp 


More information about the Pkg-openldap-devel mailing list