[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: (ITS#6587) lconn_refcnt is not thread-safe
test.007@seznam.cz wrote:
> Full_Name: Test Seven
> Version: 2.4.22
> OS: Windows
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (195.113.184.10)
>
>
> lconn_refcnt is read and written without any sync mechanism, which may cause
> subtle multi-threading issues.
You're mistaken. ld->ld_res_mutex is owned in all cases where lc->lconn_refcnt
is touched.
> E.g. libldap/result.c -r1.172
> #ifdef LDAP_R_COMPILE
> ldap_pvt_thread_mutex_unlock(&ld->ld_conn_mutex );
> #endif
> rc = try_read1msg( ld, msgid, all, lc, result );
> lnext = lc->lconn_next;
> /* Only take locks if we're really freeing */
> if ( lc->lconn_refcnt<= 1 ) {
> #ifdef LDAP_R_COMPILE
> ldap_pvt_thread_mutex_lock(&ld->ld_req_mutex );
> #endif
> ldap_free_connection( ld, lc, 0, 1 );
>
>
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/