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

Re: BUG: Unclean shutdown on SIGTERM (ITS#1227)

Currently SIGINT and SIGTERM are both treated the same.
Currently, a more drastic method is SIGKILL.

The halt(8) problem is that orderly shutdown initiated
by SIGTERM may not complete before halt(8) sends a
SIGKILL.  This problem most often arises when the user
configures OpenLDAP with dbnosync but can easily
occur in other situations (such as when SIGTERM comes
in the middle of a modify request).

If your operating system does provide a mechanism for
the orderly shutdown of complex services, then one needs
to shutdown the service themselves.  I note that the
method provided by BSD system shutdown scheme doesn't
allow for orderly shutdown of complex services as it
doesn't guarantee that the service will be given needed
resources before it -KILLed.  That is N (5?) seconds of
real time between TERM and KILL signals does not necessarily
give any time, let alone enough time, to slapd to

Eventually, slapd will either support a slow but safe
shutdown via SIGINT and a fast but not necessarily safe
shutdown via SIGTERM (hence why we recommend folks use
-INT for manual shutdown) and support better recovery
when the SIGKILL comes too soon.

I believe it best to continue recommending use of -INT
to shutdown, however it may be appropriate to note that
-TERM is currently equivalent.


At 11:45 AM 7/9/2001, lists-openldap@bsws.de wrote:
>Full_Name: Henning Brauer
>Version: 1.2.11
>OS: OpenBSD 2.9
>Submission from: (NULL) (
>Excerpt from a discussion on the qmail-ldap list:
>From: Henning Brauer <lists-qmailldap@bsws.de>
>To: qmail-ldap@argus.pipeline.ch
>Subject: Re: slapd start/stop
>Date: Mon, 9 Jul 2001 19:48:33 +0200
>On Mon, Jul 09, 2001 at 05:16:14PM -0000, pop corn wrote:
>> I already did a "man svc". Here are two quotes:
>> From the OpenLDAP 2.0 Administrator's Guide at:
>> http://www.openldap.org/doc/admin/runningslapd.html#Stopping slapd
>> 6.3. Stopping slapd
>> To kill off slapd safely, you should give a command like this
>>         kill -INT `cat /usr/local/var/slapd.pid`
>> where /usr/local/var is determined by configure.
>> Killing slapd by a more drastic method may cause information loss or
>> database corruption.
>This is a dramatic design failure in OpenLDAP. What happens on system
>shutdown? Right, all processes get a TERM signal.
>I haven't read these statements until today, but it may explain OpenLDAPs poor
>behaviour (meaning database not beeing writeable any longer) twice a year or
>so. Who files a bug report?
>Oh, I hear you saying: just use kill -INT blabla in your
>/etc/rc.d/rc.2/slapd or whatever it is. But Note that this is SysV specific,
>and there are non-SysV unices around (all BSDs for example), and this is a
>Good Thing (tm). I really don't like this SysV init style, but I'll stop my
>rant now.
>Nontheless, instead of working around this OpenLDAP bug in daemontools fix
>> I am not trying to argue with you, I am only trying to understand exactly
>> how to stop slapd because of the warning from the OpenLDAP Administrator's
>> Guide above: "Killing slapd by a more drastic method may cause information
>> loss or database corruption.".
>There is one problem I see about twice a year, OpenLDAP can no longer make
>updates. erasing a reinitializing the database fixes this. (btw, OpenLDAP
>1.2.11). BUT this is in no way related to killing the process. In production
>usage there is no reason to stop and restart slapd or to stop it at all. So
>it only gets killed on reboots, and OpenBSD machines don't boot that often
>usually ;-))
>This behaviour is an OpenLDAP bug.