]> granicus.if.org Git - apache/commitdiff
prefork MPM: Ignore mutex errors during graceful restart. For
authorJeff Trawick <trawick@apache.org>
Fri, 14 Jun 2002 03:11:43 +0000 (03:11 +0000)
committerJeff Trawick <trawick@apache.org>
Fri, 14 Jun 2002 03:11:43 +0000 (03:11 +0000)
certain types of mutexes (particularly SysV semaphores), we
should expect to occasionally fail to obtain or release the
mutex during restart processing.

These mutex failures seem to be a pretty rare occurrence, but
it was fatal.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95665 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/mpm/prefork/prefork.c

diff --git a/CHANGES b/CHANGES
index e9f1bf7720c94819f355e6c593a501aaa6343112..32c3c828822946f71d9ec4da7639380a84d0150e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,10 @@
 Changes with Apache 2.0.38
 
+  *) prefork MPM: Ignore mutex errors during graceful restart.  For
+     certain types of mutexes (particularly SysV semaphores), we
+     should expect to occasionally fail to obtain or release the
+     mutex during restart processing.  [Jeff Trawick]
+
   *) Fix install-bindist.sh so that it finds any perl instead of just
      early perl 5.x versions.  This is consistent with a build/install
      from source, and it allows the perl scripts installed by a bindist 
index 87c13f2775b8b6560a0b443e39e97379acc70117..3d13b13638cf6042e781ecad20a6d902e362acb5 100644 (file)
@@ -172,6 +172,7 @@ static pid_t parent_pid;
 #ifndef MULTITHREAD
 static int my_child_num;
 #endif
+ap_generation_t volatile ap_my_generation=0;
 
 #ifdef TPF
 int tpf_child = 0;
@@ -239,8 +240,17 @@ static void accept_mutex_on(void)
 {
     apr_status_t rv = apr_proc_mutex_lock(accept_mutex);
     if (rv != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "couldn't grab the accept mutex");
-        exit(APEXIT_CHILDFATAL);
+        const char *msg = "couldn't grab the accept mutex";
+
+        if (ap_my_generation != 
+            ap_scoreboard_image->global->running_generation) {
+            ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, msg);
+            clean_child_exit(0);
+        }
+        else {
+            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, msg);
+            exit(APEXIT_CHILDFATAL);
+        }
     }
 }
 
@@ -248,8 +258,20 @@ static void accept_mutex_off(void)
 {
     apr_status_t rv = apr_proc_mutex_unlock(accept_mutex);
     if (rv != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, "couldn't release the accept mutex");
-        exit(APEXIT_CHILDFATAL);
+        const char *msg = "couldn't release the accept mutex";
+
+        if (ap_my_generation != 
+            ap_scoreboard_image->global->running_generation) {
+            ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, msg);
+            /* don't exit here... we have a connection to
+             * process, after which point we'll see that the
+             * generation changed and we'll exit cleanly
+             */
+        }
+        else {
+            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, msg);
+            exit(APEXIT_CHILDFATAL);
+        }
     }
 }
 
@@ -364,7 +386,6 @@ static void just_die(int sig)
 static int volatile shutdown_pending;
 static int volatile restart_pending;
 static int volatile is_graceful;
-ap_generation_t volatile ap_my_generation=0;
 
 static void sig_term(int sig)
 {