[Date Prev][Date Next] [Chronological] [Thread] [Top]

Multi-threaded slapd on AIX 4.2.1



I've recently encountered problems building on AIX 4.2.0, so I've
resurrected this old email from the archives...
>>>
From: "Kurt D. Zeilenga" <Kurt@OpenLDAP.org>
Date: Wed, 30 Jun 1999 09:21:22 -0700
Cc: OpenLDAP-devel@OpenLDAP.org
In-Reply-To: <3.0.5.32.19990630175323.008c1350@mail>

----------------------------------------------------------------------------
----

At 05:53 PM 6/30/99 +0200, Fr??ic Poels wrote:
>1) Threads need a special setup on AIX 4.2.1 so the cc_r compiler must be
>used instead of cc :
>export CC=cc_r
>./configure --my-options

What threading features did configure detect?  Specifically,
did it detect Pthread draft4 or final compatible threading?
Did it detect sched_yield and/or pthread_yield()?
If final was detected, does your system have sched_yield?
Is the detection consistent with AIX's threading implementation?

I can infer some of this from your patch... but the above would
be useful in general.
<<<
configure detected final-compatible threading. The system has pthread_yield,
not sched_yield.

>>>
>2) By default, threads are created "detached" on AIX 4.2.1. To create them
>"undetached" (or "joinable"), an explicit parameter must be passed to
>pthread_create :

Yiks!  This will break most every thread application that relies on
threads being joinable by default (as required by the standard).
Looks like it's fixed in AIX 4.3.

I also noticed that you used a flag PTHREAD_CREATE_UNDETACHED.
Does AIX not have PTHREAD_CREATE_JOINABLE?
<<<
AIX 4.2 does not have PTHREAD_CREATE_JOINABLE.
>>>
Or, is this a problem with the pthread_create call using NULL
instead of the Pthread draft4 pthread_attr_default macro.  If
your system was detected as draft4, I'd be curious to whether
or not using pthread_attribute_default would provide joinable
threads.   Our devel code uses pthread_attribute_default when
draft4 is detected.
<<<
The AIX documentation says that threads are created Detached by default,
so I would guess that using pthread_attribute_default will give the same
behavior.
>>>
>The resulting slapd (with the gdbm backend) runs fine and gives a good
>response time but is subject to huge memory leaks. The same server compiled
>on a Linux box does not appear to grow (with the gdbm backend again).
>Neither does the same server compiled on AIX without threads support. Can
>anybody help?

I suspect pthread_detach() is not detaching the threads...
resulting in significant resource leakage.
<<<
None of the AIX documentation even mentions the pthread_detach() function,
although it is present in pthread.h and in the library. At this point, my
configure is complaining that pthread_create() is incompatible, because the
test program gets an ESRCH returned from pthread_detach().

Got any ideas how to modify this particular test?

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc