Bug 528124

Summary: openldap slapd init script does not wait for database shutdown
Product: Red Hat Enterprise Linux 5 Reporter: Ingvar Hagelund <ingvar>
Component: openldapAssignee: Jan Zeleny <jzeleny>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-daemons
Severity: high Docs Contact:
Priority: medium    
Version: 5.4CC: jplans, matteo.scaramuccia
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://www.openldap.org/lists/openldap-software/200910/msg00013.html
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-10-19 09:01:01 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch for ldap init script fixing missing -d option to killproc none

Description Ingvar Hagelund 2009-10-09 09:20:17 UTC
Created attachment 364226 [details]
patch for ldap init script fixing missing -d option to killproc

Description of problem:
When running "service ldap stop", the init script calls killproc without the -d option, thus killproc does not wait more than the minimum time before killing the process. With a large ldap catalog, this is not enough, and db corruption may occur.

Version-Release number of selected component (if applicable):
openldap-servers-2.3.43-3.el5, and all earlier versions.

How reproducible:
Often with large datasets

Steps to Reproduce:
See the mail thread at
http://www.openldap.org/lists/openldap-software/200910/msg00012.html
  
Actual results:
init script does not wait long enough for slapd shutdown. ldap db corruption may occur.

Expected results:
The init script should have a configurable timeout from sysconfig like the fedora init script has had since 2.4.11-3, and wait the configured time before killing slapd.

Additional info:
Fixing this is trivial. See attached diff.

Btw, adding support for killproc's -p (pidfile) option would also a good thing, as this makes the system less prone to kill wrong processes. (But remember that killproc's -p option is not supported in rhel4 and earlier).

Comment 1 Jan Zeleny 2009-10-19 09:01:01 UTC
After some walk through bugzilla, I found another bug describing this solution, closing this one as duplicate.

*** This bug has been marked as a duplicate of bug 452064 ***

Comment 2 Matteo Scaramuccia 2009-10-20 07:53:43 UTC
Please keep me updated about the resolution through this bug, if possible, since I cannot access to the source for this duplication, #452064 (Access Denied. You are not authorized to access bug #452064.). TIA.

Comment 3 Jan Zeleny 2009-10-20 08:58:36 UTC
I'm hoping to get the bug approved for fix in RHEL 5.5. If it happens, updates will be available through RHN.

For now, this is basically the patch I will be applying:
--- ldap_real_orig/ldap.init    2008-04-03 08:43:46.000000000 +0100
+++ ldap/ldap.init      2008-04-03 08:37:30.000000000 +0100
@@ -180,7 +180,7 @@ function stop() {
        # Stop daemons.
        prog=`basename ${slapd}`
        echo -n $"Stopping $prog: "
-       killproc ${slapd}
+       killproc -d $STOP_DELAY ${slapd}
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ]; then