Date: Wed, 19 Sep 2007 14:29:59 +0200 (CEST) From: Oliver Fromme <olli@secnetix.de> To: FreeBSD-gnats-submit@FreeBSD.org Cc: Oliver Fromme <olli@secnetix.de> Subject: conf/116464: [PATCH] /etc/rc.d/named restart sometimes fails Message-ID: <200709191229.l8JCTxY5078976@lurza.secnetix.de> Resent-Message-ID: <200709191310.l8JDA1Vr037186@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 116464 >Category: conf >Synopsis: [PATCH] /etc/rc.d/named restart sometimes fails >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Sep 19 13:10:00 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Oliver Fromme >Release: FreeBSD 6.2-STABLE i386 >Organization: secnetix GmbH & Co. KG http://www.secnetix.de/bsd >Environment: The problem affects RELENG_6 as well as HEAD (7-current). >Description: The command "/etc/rc.d/named restart" sometimes fails to start named after it has been stopped. Most of the time it works fine, but in rare cases it fails. It just happened to me a few minutes ago: # /etc/rc.d/named restart Stopping named. named already running? (pid=27758). # # /etc/rc.d/named restart Stopping named: rndc failed, trying killall: No matching processes belonging to you were found Starting named. # I tagged this PR "serious", because the problem can cause machines to run without named when the restart fails, especially when the restart is initiated unattended from cron jobs. Upon inspection of the script, it seems that "rndc stop" does not terminate the process right away, but it needs a short time for termination. However, the rc.d restart function does not wait for it to be terminated and tries to start it immediately, which sometimes fails if the daemon is still running. The patch below lets the rc.d stop function wait for the process to terminate. I haven't been able to reproduce the problem with this patch. >How-To-Repeat: See above. >Fix: --- etc/rc.d/named.old 2007-09-19 14:04:17.000000000 +0200 +++ etc/rc.d/named 2007-09-19 14:04:42.000000000 +0200 @@ -90,10 +90,12 @@ echo -n "Stopping named" if rndc stop 2>/dev/null; then echo . + run_rc_command poll else echo -n ": rndc failed, trying killall: " if killall named; then echo . + run_rc_command poll fi fi } >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200709191229.l8JCTxY5078976>