[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
slapd hangs for 5 seconds when doing successive connections
Hi.
I'd like to ask for help on the following problem, which I suspect may
correspond to a buggy behaviour of slapd. Although I spent quite some
time trying to isolate the issue, I can't figure out what to do to solve
it :(
I'm running slapd on a Debian GNU/Linux "stable" system. And on the same
machine, I'm running a C (or PHP) program which tries several ldap_open
+ ldap_bind calls in a row on the same LDAP server.
My problem is that every 3 connections that way, the program hangs for 5
seconds, then continues for the next 3 series, and so on. Ex (with the
following C code):
1
2
3
... 5 seconds lag ...
4
5
6
... 5 seconds lag ...
etc.
I first encountered this behaviour in a PHP program (actually a
PhpGroupware application) without much idea of where the problem came
from, then I isolated the issue down in writing the attached C program
using libldap.
I tried to change the version of OpenLDAP from the one in the Debian
distribution (2.0.23) to the latest stable version of openldap (2.1.22),
but the issue is still there.
I changed also the Linux Kernel version from 2.4.18 to 2.4.21, but not
better :(
Also, I tried to remove the SMP support of my Linux kernel (since the
machine is bi-processor)... but not much better either :((
But, whenever I try on another machine running a Debian "testing"
distribution (kernel 2.4.21, openldap 2.1.22, etc.), then there is no
hang (same LDAP base contents)...
I also tried to look at debug information in the syslog with different
loglevel values, but couldn't see real useful hints :(
I also tried to add some threads and concurrency values to the
slapd.conf without much success :(
I suspect the difference may come from the GNU libc, but cannot afford
to upgrade it on my production machine :(
Would anybody have advices on what to do, and if it's a know problem ?
I know it may not be the smartest thing to do, to try and make
successive open/init and bind calls in a row (at least in C) instead of
reusing the same connection, but still, I wouldn't expect a 5 seconds
delay between connections.
I suspect something having to deal with multi-threading and connections
management (pending connection queues or something) ?
Many thanks in advance.
==== copy of the C program which shows the problem ====
/*
if ((ld = ldap_init(ldap_host, LDAP_PORT)) == NULL ) {
*/
for (i=0; i<10; i++)
{
/* usleep(1000000); */
printf("%d\n", i);
if ((lds[i] = ldap_open(ldap_host, LDAP_PORT)) == NULL ) {
perror( "ldap_init failed" );
exit( EXIT_FAILURE );
}
/* set the LDAP version to be 2 */
if (ldap_set_option(lds[i], LDAP_OPT_PROTOCOL_VERSION,
&desired_version) != LDAP_OPT_SUCCESS)
{
ldap_perror(lds[i], "ldap_set_option");
exit(EXIT_FAILURE);
}
if (ldap_bind_s(lds[i], root_dn, root_pw, auth_method) !=
LDAP_SUCCESS ) {
ldap_perror( lds[i], "ldap_bind" );
exit( EXIT_FAILURE );
}
ldap_unbind(lds[i]);
}
=====================
--
Olivier BERGER <olivier.berger@int-evry.fr>
Ingénieur Recherche - Dept INF
INT Evry (http://www.int-evry.fr)
OpenPGP-Id: 1024D/6B829EEC