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

Re: connection pooling in back-ldap?



At 12:17 PM 2002-10-14, Lawrence Greenfield wrote:
>It probably makes more sense to do this outside of libldap_r.

I would argue that the library should better support threading.
Even if you use the async API, you still have a problem in
that application would need to poll for results if it also
wants to asynchronously send requests.  One can, of course,
grab the socket descriptor and use select(2) to determine when
to poll for results (e.g., call ldap_result() with an immediate
timeout)... but even here you end up problems if the descriptor
would have get write blocked.  Basically, the async send
may interfere with the applications select(2).  This all would
not be for the faint of heart...

The problem is that libldap(_r) does way too much with an
LDAP session... requiring lots of locks around system 
calls likely to be used else where by the application.  This
is problematic because you need to protect not only the
calls made by libldap_r but those made else where.

So, to do threading "right", you'd really need to significantly
redesign the API.  If done properly, the API would be basically
thread-free (but requiring the application to provide serialization
where necessary).