Re: openldap slapd startup delay

From: Sean McNeil <sean_at_mcneil.com>
Date: Wed, 17 Nov 2004 12:35:47 -0800
On Wed, 2004-11-17 at 13:50 +0000, Dick Davies wrote:
> * Ivan Voras <ivoras_at_fer.hr> [1124 13:24]:
> > I'm running pam_ldap & nss_ldap fine, but there's a huge delay when 
> > slapd starts (upto 30sec.). During the delay there's no load on the 
> > machine, and it's listening on hosts that are name-resolvable via 
> > /etc/hosts (it has priority in /etc/nsswitch.conf).
> 
> I saw this for the past three weeks - it appears to be a problem with
> the rc script. If you run 'ps awwux'and copy the command line shown to
> a script, it starts straight away.
> 
> 
> I replaced it with this, which starts instantly :
> 
> 
> root_at_eris exim # less /usr/local/etc/rc.d/000._slappy.sh 
> #!/bin/sh
> 
> # please don't mistake me for someone who gives a shit that I check a pidfile
> # twice in the stop function, I am too old and lazy to learn shell.
> 
> 
> DAEMON="/usr/local/libexec/slapd"
> PIDFILE="/var/run/openldap/slapd.pid"
> CFG="/usr/local/etc/openldap/slapd.conf"
> FLAGS='-h ldaps://ldap.domain/ ldap://ldap.domain -u ldap -g ldap'
> 
> 
> case $1 in
> start)
>     [ -x ${DAEMON} ] && {
>         echo -n ' starting slapd'
>         ${DAEMON} ${FLAGS}
>     }
>     ;;
> 
> stop)
>     [ -f ${PIDFILE} ] || ( echo ' slapd not running? (no ${PIDFILE})' && exit )
>     [ -f ${PIDFILE} ] && {
>         echo -n ' stopping slapd'
>         kill `cat ${PIDFILE}`
>     }
>     ;;
> 
> restart)
>         stop
> 				start
>     ;;
> 
> *)
>     echo "usage: `basename $0` {start|stop|restart}" >&2
>     exit 64
>     ;;
> esac

Does this fix the start delay, or the problem with stop?  I have traced
through the start delay and found it is because slapd is opening the
socket and then there is a lookup on group which causes it to try to
read from slapd and you are in a deadlock until the socket times out.
This has always been normal for me (the delay on startup) and others.

Sean


Received on Wed Nov 17 2004 - 19:35:57 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:22 UTC