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

RE: Multi-threaded Client Development With libldap_r



Howard, in looking at the back-ldap source, it looks like it's safe for
multiple threads to simultaneously use a single LDAP handle for searching in
2.2.x.  Is that correct?  I did notice some mutex code in the places you'd
usually see thread synchronization being performed (bind.c, init.c,
unbind.c), however it was hard for me to discern what functions I should be
"extremely careful" when calling besides the usual suspects (those used
during bind and unbind operations, for example)...can you give me a short
rundown on what I should specifically watch out for?

Thanks again,

Jason

-----Original Message-----
From: Howard Chu [mailto:hyc@highlandsun.com] 
Sent: Thursday, January 29, 2004 4:46 PM
To: 'Jason Raneses'; openldap-software@OpenLDAP.org
Subject: RE: Multi-threaded Client Development With libldap_r

libldap_r still provides only very rudimentary thread support; enough to
make
slapd and slurpd work. The 2.2 library is slightly more flexible than 2.1; I
added enough to it to allow back-ldap to perform multiple LDAP operations
over a single handle. However, you need to be Extremely Careful about what
functions you call. I suggest you read the 2.2 back-ldap source code to see
what is known to work. You're of course welcome to try anything you like and
fix whatever problems you encounter.

There was someone on the -devel list who had talked about implementing the
rest of the proposed thread-safety features but I've never seen a code
submission so I have no idea where that went.

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

-----Original Message-----
From: owner-openldap-software@OpenLDAP.org
[mailto:owner-openldap-software@OpenLDAP.org]On Behalf Of Jason Raneses

I'm developing a library which uses libldap_r and it must service
simultaneous search requests on a single open connection.  These search
requests must all access one LDAP handle at the same time and must be able
to
concurrently return results with out blocking.

Is this type of functionality currently possible to develop using libldap_r?
A lot of documentation I've been able to find about the library states that
it is thread-safe; however, I've read some archived list posting that state
otherwise.

Kurt posted a response to a similar question back in January 2002, but I'm
not sure if the answer given still holds true today:

http://www.openldap.org/lists/openldap-software/200201/msg00045.html

There was also a recent conversation on the dev mailing list about this
topic:

http://www.openldap.org/lists/openldap-devel/200311/msg00032.html

If the answer is "no, it's not directly supported", is there anything
available similar to the functionality in the Mozilla LDAP C libraries that
can be tied into (ldap_thread_fns, etc.)?

http://www.mozilla.org/directory/csdk-docs/threaded.htm#15279

Thanks in advance,

Jason