From owner-freebsd-bugs@FreeBSD.ORG Wed Sep 19 13:10:01 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFF8016A421 for ; Wed, 19 Sep 2007 13:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C7C4B13C46E for ; Wed, 19 Sep 2007 13:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l8JDA11M037187 for ; Wed, 19 Sep 2007 13:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l8JDA1Vr037186; Wed, 19 Sep 2007 13:10:01 GMT (envelope-from gnats) Resent-Date: Wed, 19 Sep 2007 13:10:01 GMT Resent-Message-Id: <200709191310.l8JDA1Vr037186@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Oliver Fromme Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F157F16A4C8 for ; 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 ; 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 To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Oliver Fromme Subject: conf/116464: [PATCH] /etc/rc.d/named restart sometimes fails X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Oliver Fromme List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Sep 2007 13:10:02 -0000 >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: