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

Re: (ITS#6625) draft-zeilenga-ldap-c-api-concurrency support




On 12/ 6/10 04:09 AM, h.b.furuseth@usit.uio.no wrote:
> I've made two fixes (I hope) to the concurrency commit, please review:
>
> - In do_abandon(), protected ldap_free_connection() with
>    ld->ld_conn_mutex.  The function would unlock it when it did not own
>    the mutex.
>
>    However I do not know why the mutex was moved out of
>    ldap_free_connection(), so maybe something more needs to be done.
>

The abandon operation is now protected by it's own abandon mutex,
not by the conn mutex.  So do_abandon is not protecting the conn
unless it is actually in use.  ldap_free_connection reference counts the
connection and only frees it if there are no other users of the connection.
This is why ldap_free_connection requires protection.

If there are multiple simultaneous threads using the connection
some of which may have in flight operations, those threads are
not interrupted by the abandon of another thread.

Consider connection A with 3 threads performing searches.
Thread 3 may abandon  it's search but threads 1 and 2 may continue
with their operations.  Removing the protection around ldap_free_connection
will disrupt the reference counting for the connection and cause
potential connection leakage and/or disrupt other threads usage
of the connection.

Doug.