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

(ITS#4001) test039 back-ldap mutex unlocked by wrong thread

Full_Name: Hallvard B Furuseth
Version: HEAD
OS: Linux
Submission from: (NULL) (
Submitted by: hallvard

back-ldap/unbind.c:ldap_back_conn_destroy() contains the code snippet:

  ldap_pvt_thread_mutex_trylock( &li->conn_mutex );
  lc = avl_delete( &li->conntree, (caddr_t)&lc_curr, ldap_back_conn_cmp );
  ldap_pvt_thread_mutex_unlock( &li->conn_mutex );

If the trylock fails, the mutex is unlocked even though another thread
locked it.

The bug comes from this change:
   revision 1.28
   date: 2005/08/06 22:35:11;  author: ando;  state: Exp;  lines: +2 -12
   use trylock only where necessary
and was triggered in test039-glue-ldap-concurrency with this backtrace:
#4  0x0818c666 in ldap_pvt_thread_mutex_unlock (mutex=0x1bdc045c)
    at thr_debug.c:758
#5  0x0810c50f in ldap_back_conn_destroy (be=0x1e6d6f80, conn=0x1bf3b4e8)
    at unbind.c:53
#6  0x080e36af in over_connection_func (bd=0x1e6d6f80, conn=0x1bf3b4e8,
    which=conn_destroy) at backover.c:675
#7  0x080e3709 in over_connection_destroy (bd=0x1bdc0298, conn=0x1bf3b4e8)
    at backover.c:700
#8  0x08089f4b in backend_connection_destroy (conn=0x1bf3b4e8) at backend.c:772
#9  0x0807a8d0 in connection_destroy (c=0x1bf3b4e8) at connection.c:645
#10 0x0807b200 in connection_close (c=0x1bf3b4e8) at connection.c:812
#11 0x0807cea5 in connection_resched (conn=0x1bf3b4e8) at connection.c:1595
#12 0x0807bc09 in connection_operation (ctx=0x1e6d72a4, arg_v=0x1d7fdff0)
    at connection.c:1113
#13 0x08189eb4 in ldap_int_thread_pool_wrapper (xpool=0x1bbce3a8)
    at tpool.c:485
#14 0x00bf9341 in start_thread () from /lib/tls/libpthread.so.0
#15 0x00a79fee in clone () from /lib/tls/libc.so.6

(thr_debug is my private wrapper package which looks for some thread errors.)