arr2036 / ldapperf Goto Github PK
View Code? Open in Web Editor NEWVery simple, threaded, LDAP directory performance checker
License: GNU General Public License v2.0
Very simple, threaded, LDAP directory performance checker
License: GNU General Public License v2.0
I get random segfaults, hinting at a race condition. Sadly direct debugging via gdb is/was pointless, so here is a backtrace from a coredump:
./ldapperf -b uid=testusr,ou=People,ou=TST,ou=default,dc=12-1234567-123456798,dc=de -S -H ldap.testserver.test
Performing 50 search(es) total, with 5 threads, with persistent connections
Segmentation fault (core dumped)
[...]
(gdb) core core
[New LWP 10854]
[New LWP 10850]
[New LWP 10852]
[New LWP 10853]
[New LWP 10851]
[New LWP 10849]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".
Core was generated by `./ldapperf -b uid=testusr,ou=People,ou=TST,ou=default,dc=12-1234567-123456798,d'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0xf76b9758 in _xend () at ../nptl/sysdeps/unix/sysv/linux/x86/elision-unlock.c:33
33 ../nptl/sysdeps/unix/sysv/linux/x86/elision-unlock.c: No such file or directory.
(gdb) bt full
#0 0xf76b9758 in _xend () at ../nptl/sysdeps/unix/sysv/linux/x86/elision-unlock.c:33
No locals.
#1 __lll_unlock_elision (lock=lock@entry=0xf771d5ac <ldap_int_hostname_mutex>, private=0) at ../nptl/sysdeps/unix/sysv/linux/x86/elision-unlock.c:29
No locals.
#2 0xf76b3080 in __pthread_mutex_unlock_usercnt (mutex=mutex@entry=0xf771d5ac <ldap_int_hostname_mutex>, decr=decr@entry=1) at pthread_mutex_unlock.c:66
type = 256
__PRETTY_FUNCTION__ = "__pthread_mutex_unlock_usercnt"
#3 0xf76b311e in __GI___pthread_mutex_unlock (mutex=0xf771d5ac <ldap_int_hostname_mutex>) at pthread_mutex_unlock.c:310
No locals.
#4 0xf76d25d8 in ldap_pvt_thread_mutex_unlock (mutex=0xf771d5ac <ldap_int_hostname_mutex>) at ../../../../libraries/libldap_r/thr_posix.c:308
No locals.
#5 0xf76ee5a3 in ldap_int_initialize (gopts=0xf771c040 <ldap_int_global_options>, dbglvl=0x0) at init.c:654
No locals.
#6 0xf76d2953 in ldap_create (ldp=0xf52a72a8) at open.c:108
ld = 0xf771c040 <ldap_int_global_options>
#7 0xf76d2caf in ldap_init (defhost=0xffa81602 "ldap.12-1234567.de", defport=389) at open.c:214
ld = 0x0
rc = <optimized out>
#8 0xf76d2d60 in ldap_open (host=0xffa81602 "ldap.12-1234567.de", port=389) at open.c:72
rc = <optimized out>
ld = <optimized out>
#9 0x080494e6 in lp_conn_init ()
No symbol table info available.
#10 0x08049afd in enter_thread ()
No symbol table info available.
#11 0xf76afefb in start_thread (arg=0xf52a7b40) at pthread_create.c:309
__res = <optimized out>
pd = 0xf52a7b40
now = <optimized out>
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-143908864, -181765312, 4001536, -181767128, -669565517, 1493978551}, mask_was_saved = 0}}, priv = {pad = {0x0,
0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call = <optimized out>
pagesize_m1 = <optimized out>
sp = <optimized out>
freesize = <optimized out>
__PRETTY_FUNCTION__ = "start_thread"
#12 0xf75d6d4e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129
No locals.
~/git/ldapperf$ ldd ./ldapperf
linux-gate.so.1 (0xf77c6000)
libldap_r-2.4.so.2 => /usr/lib/i386-linux-gnu/libldap_r-2.4.so.2 (0xf7735000)
libpthread.so.0 => /lib/i386-linux-gnu/i686/cmov/libpthread.so.0 (0xf7719000)
liblber-2.4.so.2 => /usr/lib/i386-linux-gnu/liblber-2.4.so.2 (0xf7708000)
libc.so.6 => /lib/i386-linux-gnu/i686/cmov/libc.so.6 (0xf755d000)
libresolv.so.2 => /lib/i386-linux-gnu/i686/cmov/libresolv.so.2 (0xf7546000)
libsasl2.so.2 => /usr/lib/i386-linux-gnu/libsasl2.so.2 (0xf7528000)
libgnutls.so.26 => /usr/lib/i386-linux-gnu/libgnutls.so.26 (0xf7448000)
libgcrypt.so.11 => /lib/i386-linux-gnu/libgcrypt.so.11 (0xf73b4000)
/lib/ld-linux.so.2 (0xf77c9000)
libdl.so.2 => /lib/i386-linux-gnu/i686/cmov/libdl.so.2 (0xf73af000)
libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xf7392000)
libtasn1.so.6 => /usr/lib/i386-linux-gnu/libtasn1.so.6 (0xf737e000)
libp11-kit.so.0 => /usr/lib/i386-linux-gnu/libp11-kit.so.0 (0xf733b000)
libgpg-error.so.0 => /lib/i386-linux-gnu/libgpg-error.so.0 (0xf7326000)
libffi.so.6 => /usr/lib/i386-linux-gnu/libffi.so.6 (0xf731e000)
With the following command, I get an SIGABRT:
./ldapperf -r filter -f "uid=@" -v -v -s sub -b dc=domain,dc=test -S -H ldap.domain.test
Reading names from "filter"
*** Error in `./ldapperf': realloc(): invalid pointer: 0xfff173f8 ***
Aborted
filter contains only two lines:
testuser1
usertest2
Debugging with gdb:
(gdb) run -r filter -f "uid=@" -v -v -s sub -b dc=domain,dc=test -S -H ldap.domain.test
Starting program: /home/oweh/git/ldapperf/ldapperf -r filter -f "uid=@" -v -v -s sub -b dc=domain,dc=test -S -H ldap.domain.test
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/i386-linux-gnu/i686/cmov/libthread_db.so.1".
Reading names from "filter"
*** Error in `/home/oweh/git/ldapperf/ldapperf': realloc(): invalid pointer: 0xffffd138 ***
Program received signal SIGABRT, Aborted.
0xf7fdad70 in __kernel_vsyscall ()
(gdb) bt full
#0 0xf7fdad70 in __kernel_vsyscall ()
No symbol table info available.
#1 0xf7da0267 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
resultvar = <optimized out>
resultvar = <optimized out>
pid = -135163904
selftid = 13847
#2 0xf7da1923 in __GI_abort () at abort.c:89
save_stage = 2
act = {__sigaction_handler = {sa_handler = 0x1, sa_sigaction = 0x1}, sa_mask = {__val = {4080, 52, 25000, 0, 2097204, 2621447, 1703963, 1, 0, 0, 0, 22800,
22800, 5, 4096, 1, 24192, 28288, 28288, 544, 1168, 6, 4096, 2, 24308, 28404, 28404, 232, 232, 0, 3, 4096}}, sa_flags = -135956872,
sa_restorer = 0x1000}
sigs = {__val = {32, 0 <repeats 31 times>}}
#3 0xf7ddee68 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0xf7ed4d9c "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175
ap = <optimized out>
fd = 4
on_2 = <optimized out>
list = <optimized out>
nlist = <optimized out>
cp = <optimized out>
written = <optimized out>
#4 0xf7de4eda in malloc_printerr (action=<optimized out>, str=0xf7ed09f6 "realloc(): invalid pointer", ptr=0xffffd138) at malloc.c:4996
buf = "ffffd138"
cp = <optimized out>
#5 0xf7de8ad7 in __GI___libc_realloc (oldmem=0xffffd138, bytes=8001) at malloc.c:2986
ar_ptr = <optimized out>
nb = <optimized out>
newp = <optimized out>
hook = <optimized out>
oldp = 0xffffd130
oldsize = 4159803392
__func__ = "__libc_realloc"
#6 0xf7de8af3 in __GI___libc_realloc (oldmem=0xffffd138, bytes=8001) at malloc.c:2961
ar_ptr = <optimized out>
nb = <optimized out>
newp = <optimized out>
hook = <optimized out>
oldp = <optimized out>
oldsize = <optimized out>
__func__ = "__libc_realloc"
#7 0x080492d8 in lp_names_file (out=0x804c8a8 <names>, path=0xffffd3f7 "filter") at ldapperf.c:254
len = 9
file = 0x804d198
buffer = "testuser1\n\000\000\000\000\000\000\000\000\000\000\001\000\000\000\234\003\000\000\370\371\264\367\330\322\362\367\234\005\363\367\070\364\327\367\364\356\362\367\001\000\000\000\b\000\000\000X\320\377\377\001\000\000\000\000\320\377\367\064\316\377\377\000\235\375\367\360\315\377\377\352b\376\367\240\315\377\377\364\356\362\367\250\315\377\377\214\332\377\367\000\000\000\000\370\371\264\367\001\000\000\000\000\000\000\000\001\000\000\000H\233\375\367", '\000' <repeats 32 times>, "\064\316\377\377\250\315\377\377\240\315\377\377\234\005\363\367H\233\375\367", '\000' <repeats 12 times>, "\377\377\377\377\000\000\000\000\210\230\327\367"...
p = 0x804d300 "testuser1"
max = 0
idx = 0
cnt = 1000
names = 0xffffd138
#8 0x0804a289 in main (argc=14, argv=0xffffd1e4) at ldapperf.c:648
i = 0
threads = 0x804d028
c = -1
stats = {successful = 0, error_session_init = 0, error_bind_fail = 0, error_search_fail = 0, before = {tv_sec = 0, tv_usec = 0}, after = {tv_sec = 0,
tv_usec = 0}}
__PRETTY_FUNCTION__ = "main"
This is on Debian Sid (updated daily) with gcc (Debian 4.9.1-15) 4.9.1 on x86.
I pulled tag v0.3, ran the makefile, the program built, no problems.
Running it seems to work fine.
I decided I wanted to try the -d flag. I get "Segmentation fault (core dumped)".
This is on an older Fedora 16 workstation. Let me know what other info you need, and I can try to get it to you. This was against an OpenLDAP 2.4.23 server.
GDB output below.
The file "netids.txt" has 1000 uids, one per line.
[waldbiec@odin ldapperf]$ gdb ./ldapperf
GNU gdb (GDB) Fedora (7.3.50.20110722-16.fc16)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/waldbiec/projects/git-survey/ldapperf/ldapperf...(no debugging symbols found)...done.
(gdb) run -b $BASE_DN -s sub -S -H ldaps://$HOST -D $BIND_DN -w $PASSWORD -r ./netids.txt -f '(uid=@)'
Starting program: /home/waldbiec/projects/git-survey/ldapperf/ldapperf -b $BASE_DN -s sub -S -H ldaps://l$HOST -D $BIND_DN -w $PASSWORD -r ./netids.txt -f '(uid=@)'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Performing 50 search(es) total, with 5 threads, with persistent connections
[New Thread 0x7ffff773c700 (LWP 43952)]
[New Thread 0x7ffff6f3b700 (LWP 43953)]
[New Thread 0x7ffff673a700 (LWP 43954)]
[New Thread 0x7ffff5f39700 (LWP 43955)]
[New Thread 0x7ffff5738700 (LWP 43956)]
[Thread 0x7ffff773c700 (LWP 43952) exited]
[Thread 0x7ffff5f39700 (LWP 43955) exited]
[Thread 0x7ffff6f3b700 (LWP 43953) exited]
[Thread 0x7ffff673a700 (LWP 43954) exited]
[Thread 0x7ffff5738700 (LWP 43956) exited]
Program received signal SIGSEGV, Segmentation fault.
0x000000376b07dd55 in malloc_consolidate (av=0x376b3b1700) at malloc.c:4266
4266 unlink(av, nextchunk, bck, fwd);
(gdb)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.