conf/116464: [PATCH] /etc/rc.d/named restart sometimes fails

Oliver Fromme olli at
Wed Sep 19 06:10:02 PDT 2007

>Number:         116464
>Category:       conf
>Synopsis:       [PATCH] /etc/rc.d/named restart sometimes fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 19 13:10:00 GMT 2007
>Originator:     Oliver Fromme
>Release:        FreeBSD 6.2-STABLE i386
secnetix GmbH & Co. KG

   The problem affects RELENG_6 as well as HEAD (7-current).


   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.


   See above.


--- 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
 		echo -n ": rndc failed, trying killall: "
 		if killall named; then
 			echo .
+			run_rc_command poll

More information about the freebsd-bugs mailing list