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

(ITS#4368) locked mutex destroyed on shutdown

Full_Name: Donn Cave
OS: NetBSD 3.0
Submission from: (NULL) (

At line 400 in libldap_r/tpool.c, in ldap_pvt_thread_pool_destroy, the thread
pool mutex gets destroyed, while the caller still holds a lock to this mutex
(evidently acquired at line 376 in the same function.)  The NetBSD 3.0 pthread
implementation aborts here with a complaint, causing a core dump.  Not sure the
core dump is really called for, but the specification says the result is
undefined (cf. http://www.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_destroy.html

I called ldap_pvt_thread_mutex_unlock(&pool->ltp_mutex) immediately before
(tpool.c:400), and that resolved the problem.  Another route might be to add a
pthread_mutex_unlock() to ldap_pvt_thread_mutex_destroy, thr_posix.c:316, if
this issue is peculiar to POSIX threads.  (Elsewhere it seems to me that destroy
implies unlock.)