httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chr...@apache.org
Subject svn commit: r409693 - in /httpd/httpd/trunk: CHANGES server/mpm/experimental/event/event.c server/mpm/worker/worker.c
Date Fri, 26 May 2006 16:27:00 GMT
Author: chrisd
Date: Fri May 26 09:26:52 2006
New Revision: 409693

URL: http://svn.apache.org/viewvc?rev=409693&view=rev
Log:
Make the worker and event MPMs not touch the scoreboard when
handling a fork() failure.  The previous behaviour appears to have
been inherited from the prefork MPM, where is it appropriate.

The prefork MPM sets thread_limit to 1 and therefore each
child process has a single worker_score structure in the scoreboard's
array, i.e., ap_scoreboard_image->servers[slot][0].  In make_child(),
it sets this structure's status to SERVER_STARTING, and then does
a fork(); if the fork() fails, it resets the status to SERVER_DEAD.

The worker and event MPMs, by constrast, obviously use multiple
worker_score structures per child process.  They may also be
in use by worker threads from a previous generation at any particular
moment.  Therefore make_child() and the parent process in general
doesn't normally update them; make_child() doesn't set them all
to SERVER_STARTING before doing fork(), for example.

So, make_child() shouldn't set them to SERVER_DEAD if fork()
fails (and even if it should, it certainly shouldn't be just
updating the first one).


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/server/mpm/experimental/event/event.c
    httpd/httpd/trunk/server/mpm/worker/worker.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=409693&r1=409692&r2=409693&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Fri May 26 09:26:52 2006
@@ -2,6 +2,9 @@
 Changes with Apache 2.3.0
   [Remove entries to the current 2.0 and 2.2 section below, when backported]
 
+  *) Worker and event MPMs: Remove improper scoreboard updates which were
+     performed in the event of a fork() failure.  [Chris Darroch]
+
   *) mod_cache: Make caching of reverse SSL proxies possible again. PR 39593.
      [Ruediger Pluem, Joe Orton]
 

Modified: httpd/httpd/trunk/server/mpm/experimental/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/experimental/event/event.c?rev=409693&r1=409692&r2=409693&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/experimental/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/experimental/event/event.c Fri May 26 09:26:52 2006
@@ -1608,10 +1608,12 @@
         ap_log_error(APLOG_MARK, APLOG_ERR, errno, s,
                      "fork: Unable to fork new process");
 
-        /* fork didn't succeed. Fix the scoreboard or else
-         * it will say SERVER_STARTING forever and ever
+        /* fork didn't succeed.  There's no need to touch the scoreboard;
+         * if we were trying to replace a failed child process, then
+         * server_main_loop() marked its workers SERVER_DEAD, and if
+         * we were trying to replace a child process that exited normally,
+         * its worker_thread()s left SERVER_DEAD or SERVER_GRACEFUL behind.
          */
-        ap_update_child_status_from_indexes(slot, 0, SERVER_DEAD, NULL);
 
         /* In case system resources are maxxed out, we don't want
            Apache running away with the CPU trying to fork over and

Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=409693&r1=409692&r2=409693&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Fri May 26 09:26:52 2006
@@ -1285,11 +1285,12 @@
     if ((pid = fork()) == -1) {
         ap_log_error(APLOG_MARK, APLOG_ERR, errno, s,
                      "fork: Unable to fork new process");
-
-        /* fork didn't succeed. Fix the scoreboard or else
-         * it will say SERVER_STARTING forever and ever
+        /* fork didn't succeed.  There's no need to touch the scoreboard;
+         * if we were trying to replace a failed child process, then
+         * server_main_loop() marked its workers SERVER_DEAD, and if
+         * we were trying to replace a child process that exited normally,
+         * its worker_thread()s left SERVER_DEAD or SERVER_GRACEFUL behind.
          */
-        ap_update_child_status_from_indexes(slot, 0, SERVER_DEAD, NULL);
 
         /* In case system resources are maxxed out, we don't want
            Apache running away with the CPU trying to fork over and



Mime
View raw message