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

Re: (ITS#5841) slapd hanging upon shutdown

The thread running ldap_pvt_thread_pool_destroy and the one that ran the index 
task (which was immediately finished after receiving the shutdown signal) are 
both waiting for the pool->ltp_cond to be signalled.

Under normal conditions (slapd is not shutting down) the signal would have 
been sent by ldap_pvt_thread_pool_resume(), called by the thread that handled 
the second modify request. But there is an explicit check for
pool->ltp_finishing in ldap_pvt_thread_pool_resume(). When pool->ltp_finishing 
is set this signal is not send.

The check for pool->ltp_finishing has been introduced with r1.81 of tpool.c. I 
am unsure what this was supposed to fix the log message is just:
"In pool_resume don't touch the condvar if the pool is tearing down."

This patch solves the problem for me, so I am unsure if it'll break other 

--- libraries/libldap_r/tpool.c 10 Mar 2008 12:21:24 -0000      1.97
+++ libraries/libldap_r/tpool.c 3 Dec 2008 14:43:28 -0000
@@ -785,8 +785,7 @@
        pool->ltp_work_list = &pool->ltp_pending_list;

-       if (!pool->ltp_finishing)
-               ldap_pvt_thread_cond_broadcast(&pool->ltp_cond);
+       ldap_pvt_thread_cond_broadcast(&pool->ltp_cond);