[Fedora-directory-devel] Please review: Bug 218076: Server autoconf build crashes when stopped/started very quickly

Richard Megginson rmeggins at redhat.com
Fri Dec 1 17:55:38 UTC 2006


https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=218076
Bug(s) fixed: 218076
Bug Description: Server autoconf build crashes when stopped/started very 
quickly
Reviewed by: ???
Files: see diff
Branch: HEAD
Fix Description: The problem was that 3 of the database threads were 
being started and stopped before the 4th had a chance to start.  So the 
thread count would start at 3 and drop to 0, and the dblayer_pre_close 
code would think everything was fine.  The 4th thread is the checkpoint 
thread which was doing a db_checkpoint operation before incrementing the 
thread count.  For some reason, on x86_64 with the system provided 
libdb-4.2, the checkpoint operation was taking longer than it usually 
does with our locally built libdb-4.2, so this allowed the other 3 
threads to stop and start before the checkpoint thread had a chance to 
increment the thread count.
The solution is to make sure the incrementing of the thread count occurs 
as early as possible in the thread function, before any executable code 
that might take any time.  This should ensure that all of the threads 
start up and increment the thread count before the shutdown occurs.
The second part of the solution is that, according to wtc, the NSPR 
maintainer, the PR_Atomic functions should not be used as a semaphore 
like this.  So, the code was rewritten to use locks and condition 
variables.  The code is not performance critical, so adding locking 
should not have any impact on performance.  In addition, the new code is 
much cleaner, more correct, and more obvious about what it's doing.
Platforms tested: RHEL4 x86_64
Flag Day: no
Doc impact: no
https://bugzilla.redhat.com/bugzilla/attachment.cgi?id=142601&action=diff




More information about the Fedora-directory-devel mailing list