(Answer) (Category) OpenLDAP Faq-O-Matic : (Category) Trash : (Answer) pthread_create fails around connection 312-340
LinuxThreads (pthreads and lwp) are preemptive and hence are not safe to use with OpenLDAP 1.x.

See also:

 (Xref) Is OpenLDAP thread safe?
 (Xref) Are third party thread packages supported?

Using RedHat Linux (5.0, 5.1), pthread_create failures have been plagueing me for quite some time. It appears in syslog for connections between 300 and 340. Here is a sample:
Jan 25 07:37:02 grendel slapd[12410]: conn=302 fd=7 connection from unknown
(148.129.119.129) accepted.
Jan 25 07:37:02 grendel slapd[12410]: pthread_create failed
Jan 25 07:37:07 grendel last message repeated 2 times
This happens for pretty much any version of OpenLDAP (I tried them all as they became available), including but not limited to 1.0, 1.1.0, 1.1.[1234].

After some hunting, I tracked it down:

The version of glibc that comes with RedHat 5.1 is glibc-2.0.7-17. This one has problems in libpthread-0.7.so. RedHat 5.2 has glibc-2.0.7-29. I don't know of any versions between the two that work, but I do know that the -29 version fixes the pthread_create problem. I upgraded only the glibc packages (glibc, -devel, -debug, -profile, but the important one is glibc shared libraries), and restarted slapd. slapd didn't fail with the pthread_create problem anymore.

OpenLDAP 1.1 users may need to fix a typo in slapd/main.c (see below).
I'm not sure of any subversions or ways to tell which pthread library is the right one, but the one that works on my system (with glibc-2.0.7-29) has a size of 198784, a date of Oct 13, and an MD5 signature of e82d06da5bffcd752bfca1c80f498b22. I've seen connections as high as 1500 (not sure if slapd was restarted or the system rebooted, but pretty sure it was a reboot).

Follow these suggestions and you'll get your slapd humming under Linux.

--
Don Badrak    301.457.8263 work
Telecommunications Office         301.457.4438 fax
U.S. Bureau of the Census
Suitland MD, USA

OpenLDAP 1.1.4 (and prior), there is a bug in servers/slapd/main.c, line 146:
It reads:

#ifdef HAVE_PHREADS_FINAL
 
and should read:

#ifdef HAVE_PTHREADS_FINAL

It's easy to fix, and has been fixed in 1.2.
This may be responsible for running out of threads because
the threads don't exist, since it is around a pthread_join() call.
[Append to This Answer]
Previous: (Answer) New Item
Next: (Answer) configure fails to recognize Pthreads on some Linux systems, what do I do?
This document is: http://www.openldap.org/faq/index.cgi?file=92
[Search] [Appearance]
This is a Faq-O-Matic 2.719.
© Copyright 2004, OpenLDAP Foundation, info@OpenLDAP.org