From olli@lurza.secnetix.de  Wed Sep 19 13:06:25 2007
Return-Path: <olli@lurza.secnetix.de>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F157F16A4C8
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 Sep 2007 13:06:25 +0000 (UTC)
	(envelope-from olli@lurza.secnetix.de)
Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8])
	by mx1.freebsd.org (Postfix) with ESMTP id 67E1713C46E
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 19 Sep 2007 13:06:25 +0000 (UTC)
	(envelope-from olli@lurza.secnetix.de)
Received: from lurza.secnetix.de (localhost [127.0.0.1])
	by lurza.secnetix.de (8.14.1/8.14.1) with ESMTP id l8JCU3IA078980;
	Wed, 19 Sep 2007 14:30:09 +0200 (CEST)
	(envelope-from oliver.fromme@secnetix.de)
Received: (from olli@localhost)
	by lurza.secnetix.de (8.14.1/8.14.1/Submit) id l8JCTxY5078976;
	Wed, 19 Sep 2007 14:29:59 +0200 (CEST)
	(envelope-from olli)
Message-Id: <200709191229.l8JCTxY5078976@lurza.secnetix.de>
Date: Wed, 19 Sep 2007 14:29:59 +0200 (CEST)
From: Oliver Fromme <olli@secnetix.de>
Reply-To: Oliver Fromme <olli@secnetix.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc: Oliver Fromme <olli@secnetix.de>
Subject: [PATCH] /etc/rc.d/named restart sometimes fails
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         116464
>Category:       conf
>Synopsis:       [PATCH] /etc/rc.d/named restart sometimes fails
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Sep 19 13:10:00 GMT 2007
>Closed-Date:    Wed Jan 16 17:34:10 UTC 2008
>Last-Modified:  Wed Jan 16 17:34:10 UTC 2008
>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:

From: Florian Smeets <flo@kasimir.com>
To: bug-followup@FreeBSD.org, olli@secnetix.de
Cc:  
Subject: Re: conf/116464: [PATCH] /etc/rc.d/named restart sometimes fails
Date: Wed, 16 Jan 2008 17:45:31 +0100

 Hi,
 
 same reply as to bin/115814.
 
 My experience is that this has been fixed with Rev. 1.27 of
 /etc/rc.d/named and has been MFCed to RELENG_6 as Rev. 1.22.2.3
 
 I think this PR can be closed.
 
 Cheers,
 Florian
 
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Wed Jan 16 17:34:09 UTC 2008 
State-Changed-Why:  
Florian reports that this had been resolved : "My experience is that 
this has been fixed with Rev. 1.27 of /etc/rc.d/named and has been MFCed 
to RELENG_6 as Rev. 1.22.2.3" 

http://www.freebsd.org/cgi/query-pr.cgi?pr=116464 
>Unformatted:
