From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Sep 21 10:40:03 2005 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7D78F16A420 for ; Wed, 21 Sep 2005 10:40:03 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0260543D4C for ; Wed, 21 Sep 2005 10:40:01 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j8LAe1g6098694 for ; Wed, 21 Sep 2005 10:40:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j8LAe1rA098693; Wed, 21 Sep 2005 10:40:01 GMT (envelope-from gnats) Resent-Date: Wed, 21 Sep 2005 10:40:01 GMT Resent-Message-Id: <200509211040.j8LAe1rA098693@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Jarrod Sayers Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA6C616A41F for ; Wed, 21 Sep 2005 10:33:28 +0000 (GMT) (envelope-from jarrod@manhattan.netleader.com.au) Received: from manhattan.netleader.com.au (manhattan.netleader.com.au [210.11.55.170]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4787643D49 for ; Wed, 21 Sep 2005 10:33:28 +0000 (GMT) (envelope-from jarrod@manhattan.netleader.com.au) Received: from manhattan.netleader.com.au (localhost [127.0.0.1]) by manhattan.netleader.com.au (8.13.4/8.13.4) with ESMTP id j8LAXEaM080516; Wed, 21 Sep 2005 20:03:15 +0930 (CST) (envelope-from jarrod@manhattan.netleader.com.au) Received: (from jarrod@localhost) by manhattan.netleader.com.au (8.13.4/8.13.4/Submit) id j8LAXEZq080515; Wed, 21 Sep 2005 20:03:14 +0930 (CST) (envelope-from jarrod) Message-Id: <200509211033.j8LAXEZq080515@manhattan.netleader.com.au> Date: Wed, 21 Sep 2005 20:03:14 +0930 (CST) From: Jarrod Sayers To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: ports/86402: [patch] Correction to prevent multiple stops's and starts's when calling restart on www/apache2 when using apache2_profiles X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jarrod Sayers List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Sep 2005 10:40:03 -0000 >Number: 86402 >Category: ports >Synopsis: [patch] Correction to prevent multiple stops's and starts's when calling restart on www/apache2 when using apache2_profiles >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Sep 21 10:40:01 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Jarrod Sayers >Release: FreeBSD 4.11-RELEASE-p11 i386 >Organization: >Environment: System: FreeBSD manhattan.netleader.com.au 4.11-RELEASE-p11 FreeBSD 4.11-RELEASE-p11 #21: Sun Jul 3 15:43:12 CST 2005 root@manhattan.netleader.com.au:/usr/obj/usr/src/sys/MANHATTAN i386 Port: www/apache2 $FreeBSD: ports/www/apache2/Makefile,v 1.226 2005/09/07 20:31:11 clement Exp $ $FreeBSD: ports/www/apache2/files/apache.sh,v 1.14 2005/09/05 15:07:49 clement Exp $ >Description: When www/apache2 is configured to use profiles, multiple start's and stop's are called when the restart directive is issued. When a large number of profiles are used, *every* profile is started and stoped for each profile, instead of each profile individually, i.e., when 5 profiles are configured, each profile restarts 5 times. When issuing a reload (a simple signal sent by rc.subr), each profile reloads, just once: manhattan# /usr/local/etc/rc.d/apache2.sh reload ===> apache2 profile: httpd171 Reloading apache2 config files. Performing sanity check on apache2 configuration: Syntax OK ===> apache2 profile: httpd171old Reloading apache2 config files. Performing sanity check on apache2 configuration: Syntax OK ===> apache2 profile: httpd172 Reloading apache2 config files. Performing sanity check on apache2 configuration: Syntax OK manhattan# Yet on a restart ($0 start, $0 stop sent by rc.subr), the apache.sh script calls itself again for each profile (just ignore the fact that httpd171 was stopped when I called it last): manhattan# /usr/local/etc/rc.d/apache2.sh restart ===> apache2 profile: httpd171 Performing sanity check on apache2 configuration: Syntax OK ===> apache2 profile: httpd171 apache2 not running? (check /var/run/httpd.httpd171.pid). ===> apache2 profile: httpd171old Stopping apache2. Waiting for PIDS: 78303. ===> apache2 profile: httpd172 Stopping apache2. Waiting for PIDS: 78310. ===> apache2 profile: httpd171 Starting apache2. ===> apache2 profile: httpd171old Starting apache2. ===> apache2 profile: httpd172 Starting apache2. ===> apache2 profile: httpd171old Performing sanity check on apache2 configuration: Syntax OK ===> apache2 profile: httpd171 Stopping apache2. Waiting for PIDS: 78417. ===> apache2 profile: httpd171old Stopping apache2. Waiting for PIDS: 78429. ===> apache2 profile: httpd172 Stopping apache2. Waiting for PIDS: 78436. ===> apache2 profile: httpd171 Starting apache2. ===> apache2 profile: httpd171old Starting apache2. ===> apache2 profile: httpd172 Starting apache2. ===> apache2 profile: httpd172 Performing sanity check on apache2 configuration: Syntax OK ===> apache2 profile: httpd171 Stopping apache2. Waiting for PIDS: 78494. ===> apache2 profile: httpd171old Stopping apache2. Waiting for PIDS: 78506. ===> apache2 profile: httpd172 Stopping apache2. Waiting for PIDS: 78518. ===> apache2 profile: httpd171 Starting apache2. ===> apache2 profile: httpd171old Starting apache2. ===> apache2 profile: httpd172 Starting apache2. manhattan# logout Or the 'set -x' version: # /usr/local/etc/rc.d/apache2.sh restart 2>&1 | grep apache2.sh + /usr/local/etc/rc.d/apache2.sh restart httpd171 You can see by the next line, that rc.subr has called 'stop' and is not aware that there was a profile attached to the restart line above, so apache.sh proceedes to stop everything. + /usr/local/etc/rc.d/apache2.sh stop + /usr/local/etc/rc.d/apache2.sh stop httpd171 + /usr/local/etc/rc.d/apache2.sh stop httpd171old + /usr/local/etc/rc.d/apache2.sh stop httpd172 + /usr/local/etc/rc.d/apache2.sh start + /usr/local/etc/rc.d/apache2.sh start httpd171 + /usr/local/etc/rc.d/apache2.sh start httpd171old + /usr/local/etc/rc.d/apache2.sh start httpd172 So, apache.sh, thinking its just restarted the first profile, goes away to restart the next one. + /usr/local/etc/rc.d/apache2.sh restart httpd171old + /usr/local/etc/rc.d/apache2.sh stop + /usr/local/etc/rc.d/apache2.sh stop httpd171 + /usr/local/etc/rc.d/apache2.sh stop httpd171old + /usr/local/etc/rc.d/apache2.sh stop httpd172 + /usr/local/etc/rc.d/apache2.sh start + /usr/local/etc/rc.d/apache2.sh start httpd171 + /usr/local/etc/rc.d/apache2.sh start httpd171old + /usr/local/etc/rc.d/apache2.sh start httpd172 Whee.... + /usr/local/etc/rc.d/apache2.sh restart httpd172 + /usr/local/etc/rc.d/apache2.sh stop + /usr/local/etc/rc.d/apache2.sh stop httpd171 + /usr/local/etc/rc.d/apache2.sh stop httpd171old + /usr/local/etc/rc.d/apache2.sh stop httpd172 + /usr/local/etc/rc.d/apache2.sh start + /usr/local/etc/rc.d/apache2.sh start httpd171 + /usr/local/etc/rc.d/apache2.sh start httpd171old + /usr/local/etc/rc.d/apache2.sh start httpd172 # >How-To-Repeat: Install www/apache2 from ports: manhattan# cd /usr/ports/www/apache2 manhattan# make install clean Add lines to /etc/rc.conf to enable apache2 profiles (filenames are fake): apache2_enable="YES" apache2_profiles="httpd1 httpd2 httpd3" apache2_httpd1_configfile="/usr/local/etc/apache2/httpd1.conf" apache2_httpd2_configfile="/usr/local/etc/apache2/httpd2.conf" apache2_httpd3_configfile="/usr/local/etc/apache2/httpd3.conf" Run: manhattan# /usr/local/etc/rc.d/apache2.sh restart >Fix: Don't rerun the apache2.sh rc script on restart's, just stop and start normally: --- www/apache2/files/apache.sh.orig Sat Sep 10 09:31:50 2005 +++ www/apache2/files/apache.sh Wed Sep 21 19:56:01 2005 @@ -67,7 +67,7 @@ echo "$0: extra argument ignored" fi else - if [ "x${apache2_profiles}" != "x" ]; then + if [ "x${apache2_profiles}" != "x" -a "x${1}" != "xrestart" ]; then for profile in ${apache2_profiles}; do echo "===> apache2 profile: ${profile}" $0 $1 $profile >Release-Note: >Audit-Trail: >Unformatted: