[Pkg-apache-commits] r1213 - in /trunk/apache2: apache2.2-common.apache2.init changelog

sf at alioth.debian.org sf at alioth.debian.org
Tue Jul 27 19:52:47 UTC 2010


Author: sf
Date: Tue Jul 27 19:52:42 2010
New Revision: 1213

URL: http://svn.debian.org/wsvn/pkg-apache/?sc=1&rev=1213
Log:
* If the init script's reload action is called immediately after the start
  action, wait a bit to allow apache2 to start and register its signal
  handlers. Closes: #589386, LP: #603192
* Support 'graceful' as alias for 'reload' in the init script.

Modified:
    trunk/apache2/apache2.2-common.apache2.init
    trunk/apache2/changelog

Modified: trunk/apache2/apache2.2-common.apache2.init
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/apache2.2-common.apache2.init?rev=1213&op=diff
==============================================================================
--- trunk/apache2/apache2.2-common.apache2.init (original)
+++ trunk/apache2/apache2.2-common.apache2.init Tue Jul 27 19:52:42 2010
@@ -167,6 +167,24 @@
 	fi
 }
 
+# After starting, apache2 needs some time until it accepts SIGHUP/SIGUSR1.
+# Check if it has just been started. If yes, wait a bit.
+apache_wait_before_reload() {
+	# modtime of pidfile in seconds since epoch
+	START=$(stat -c %Y "$PIDFILE" 2>/dev/null || true)
+	[ -n "$START" ] || return 0
+	# now in seconds since epoch
+	NOW=$(date +%s)
+	if [ $(( $NOW - $START )) -le 2 ] ; then
+		echo -n " ... waiting "
+		sleep 2
+	fi
+
+	# Reloading shortly after the last reload is racy.
+	# To be save, force a wait on the next reload.
+	touch "$PIDFILE"
+}
+
 case $1 in
 	start)
 		log_daemon_msg "Starting web server" "apache2"
@@ -202,13 +220,14 @@
 		else
 			log_daemon_msg "Stopping web server" "apache2"
 		fi
+		apache_wait_before_reload
 		if $APACHE2CTL graceful-stop; then
                         log_end_msg 0
                 else
                         log_end_msg 1
                 fi
 	;;
-	reload | force-reload)
+	reload | force-reload | graceful)
 		if ! $APACHE2CTL configtest > /dev/null 2>&1; then
                     $APACHE2CTL configtest || true
                     log_end_msg 1
@@ -216,6 +235,7 @@
                 fi
                 log_daemon_msg "Reloading web server config" "apache2"
 		if pidof_apache > /dev/null ; then
+                    apache_wait_before_reload
                     if $APACHE2CTL graceful $2 ; then
                         log_end_msg 0
                     else

Modified: trunk/apache2/changelog
URL: http://svn.debian.org/wsvn/pkg-apache/trunk/apache2/changelog?rev=1213&op=diff
==============================================================================
--- trunk/apache2/changelog (original)
+++ trunk/apache2/changelog Tue Jul 27 19:52:42 2010
@@ -1,3 +1,12 @@
+apache2 (2.2.16-2) UNRELEASED; urgency=low
+
+  * If the init script's reload action is called immediately after the start
+    action, wait a bit to allow apache2 to start and register its signal
+    handlers. Closes: #589386, LP: #603192
+  * Support 'graceful' as alias for 'reload' in the init script.
+
+ -- Stefan Fritsch <sf at debian.org>  Tue, 27 Jul 2010 20:58:40 +0200
+
 apache2 (2.2.16-1) unstable; urgency=medium
 
   * Urgency medium for security fix.




More information about the Pkg-apache-commits mailing list