Hi,

 

We have a long running server that tries to get a new LDAP handle if the current handle becomes invalid (LDAP_SERVER_DOWN error, etc).

However if I call ldap_unbind_ext_s() on the old handle to release it, it hangs with the following stack:

 

(gdb) bt

#0  0x000000080166935c in read () at read.S:2

#1  0x00000008014748f0 in __read (fd=68, buf=0x803293003, nbytes=5) at /.automount/nfs.panwest.panasas.com/root/sb10/hlewis/hlewis-sb10-pioneer-ldap/src/freebsd-c/lib/libthr/thread/thr_syscalls.c:384

#2  0x0000000802c715d2 in sb_stream_read (sbiod=0x8088070d0, buf=0x803293003, len=5) at /.automount/nfs.panwest.panasas.com/root/sb10/hlewis/hlewis-sb10-pioneer-ldap/src/likewise/openldap/libraries/liblber/sockbuf.c:493

#3  0x0000000802c7207e in sb_debug_read (sbiod=0x803291220, buf=0x803293003, len=5) at /.automount/nfs.panwest.panasas.com/root/sb10/hlewis/hlewis-sb10-pioneer-ldap/src/likewise/openldap/libraries/liblber/sockbuf.c:827

#4  0x0000000802356971 in tlso_bio_read (b=0x803205400, buf=0x803293003 "\027\003\001", len=5) at tls_o.c:687

#5  0x000000080252c2df in BIO_read () from /usr/lib/libcrypto.so.1.0.0

#6  0x0000000802eb9f01 in ssl3_read_n () from /usr/lib/libssl.so.1.0.0

#7  0x0000000802eba3ce in ssl3_read_bytes () from /usr/lib/libssl.so.1.0.0

#8  0x0000000802eb67ac in ssl3_shutdown () from /usr/lib/libssl.so.1.0.0

#9  0x0000000802356cf6 in tlso_sb_close (sbiod=0x803291250) at tls_o.c:808

#10 0x0000000802c71253 in ber_int_sb_close (sb=0x803291160) at /.automount/nfs.panwest.panasas.com/root/sb10/hlewis/hlewis-sb10-pioneer-ldap/src/likewise/openldap/libraries/liblber/sockbuf.c:383

#11 0x000000080233d625 in ldap_free_connection (ld=0x804c48c00, lc=0x8088080f0, force=1, unbind=1) at request.c:769

#12 0x000000080232ffa2 in ldap_ld_free (ld=0x804c48c00, close=1, sctrls=0x0, cctrls=0x0) at unbind.c:93

#13 0x000000080232fe8b in ldap_unbind_ext (ld=0x804c48c00, sctrls=0x0, cctrls=0x0) at unbind.c:52

#14 0x000000080232fec5 in ldap_unbind_ext_s (ld=0x804c48c00, sctrls=0x0, cctrls=0x0) at unbind.c:61

……

 

I want to make sure that there are memory leaks etc, hence the attempt to release the invalid handle.

 

Question: What is the best or correct way to release an invalid LDAP handle?

 

Appreciate any help.

Thanks

R.K. Aditham