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

Re: (ITS#6853) slapadd/slapindex -q hang



This is a multi-part message in MIME format.
--------------070307090101090304000508
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Quanah Gibson-Mount wrote:
>
>
> --On March 9, 2011 9:42:18 AM -0800 Howard Chu<hyc@symas.com>  wrote:
>
>> Quanah Gibson-Mount wrote:
>>>
>>>
>>> --On March 4, 2011 11:14:46 PM +0000 dhawes@vt.edu wrote:
>>>> Tested, and working.  Thanks for the fix.
>>>
>>> We're still seeing this happen sporadically with slapindex -q<attribute>
>>>
>>> i.e., reindexing a single attribute instead of the entire DB
>>
>> Can't reproduce it here, need a test case.
>
> It's hard to come up with one.  We've only had this one instance on one
> machine.

I reproduced your hang by adding a sleep(1) in front of the trickle task. This 
patch fixes it. I can't commit at the moment because cvs-master.openldap.org 
is not answering.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

--------------070307090101090304000508
Content-Type: text/plain;
 name="dif.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="dif.txt"

Index: tools.c
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/servers/slapd/back-bdb/tools.c,v
retrieving revision 1.141
diff -u -r1.141 tools.c
--- tools.c	11 Mar 2011 21:16:13 -0000	1.141
+++ tools.c	16 Mar 2011 06:35:09 -0000
@@ -1,5 +1,5 @@
 /* tools.c - tools for slap tools */
-/* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/tools.c,v 1.141 2011-03-11 21:16:13 hyc Exp $ */
+/* $OpenLDAP: pkg/ldap/servers/slapd/back-bdb/tools.c,v 1.141 2011/03/11 21:16:13 hyc Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
  * Copyright 2000-2011 The OpenLDAP Foundation.
@@ -162,6 +162,12 @@
 		slapd_shutdown = 1;
 #ifdef USE_TRICKLE
 		ldap_pvt_thread_mutex_lock( &bdb_tool_trickle_mutex );
+
+		/* trickle thread may not have started yet */
+		while ( !bdb_tool_trickle_active )
+			ldap_pvt_thread_cond_wait( &bdb_tool_trickle_cond_end,
+					&bdb_tool_trickle_mutex );
+
 		ldap_pvt_thread_cond_signal( &bdb_tool_trickle_cond );
 		while ( bdb_tool_trickle_active )
 			ldap_pvt_thread_cond_wait( &bdb_tool_trickle_cond_end,
@@ -1256,6 +1262,7 @@
 
 	ldap_pvt_thread_mutex_lock( &bdb_tool_trickle_mutex );
 	bdb_tool_trickle_active = 1;
+	ldap_pvt_thread_cond_signal( &bdb_tool_trickle_cond_end );
 	while ( 1 ) {
 		ldap_pvt_thread_cond_wait( &bdb_tool_trickle_cond,
 			&bdb_tool_trickle_mutex );

--------------070307090101090304000508--