]> granicus.if.org Git - apache/commitdiff
Win32: Track and display "Parent Server Generation:" in
authorBill Stoddard <stoddard@apache.org>
Tue, 23 Oct 2001 17:13:26 +0000 (17:13 +0000)
committerBill Stoddard <stoddard@apache.org>
Tue, 23 Oct 2001 17:13:26 +0000 (17:13 +0000)
mod_status output. The generation will be bumped at
server graceful restart, when the child process exits
by hitting MaxRequestsPerChild or if the child
process exits abnormally. [Bill Stoddard]

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

CHANGES
server/mpm/winnt/mpm_winnt.c

diff --git a/CHANGES b/CHANGES
index 1ad9ee67a976b5593b0b5baaa51c194ea8f1d857..83a1b3d39f645b30bcbef8886444e71701daf3ca 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,15 @@
 Changes with Apache 2.0.27-dev
+  *) Win32: Track and display "Parent Server Generation:" in
+     mod_status output. The generation will be bumped at
+     server graceful restart, when the child process exits
+     by hitting MaxRequestsPerChild or if the child 
+     process exits abnormally. [Bill Stoddard]
+
+  *) Win32: Fix problem where MaxRequestsPerChild directive was
+     not being picked up in favor of the default. Enable
+     the parent to start up a new child process immediately upon
+     the old child starting shutdown.
+     [Bill Stoddard]
 
   *) Fix some bungling of the remote port in rfc1413.c so that 
      IdentityCheck retrieves the proper user id instead of failing
index 6f983d3448be7a9060c334792519961d26e7ed01..5d2c448b33f4ecd5a1eca0798aa868bdf1eaea9c 100644 (file)
@@ -1216,24 +1216,23 @@ static int create_process(apr_pool_t *p, HANDLE *child_proc, HANDLE *child_exit_
         pCommand = apr_pstrcat(p, pCommand, " \"", ap_server_conf->process->argv[i], "\"", NULL);
     }
 
-    /* Build the environment, since Win9x disrespects the active env */
-    pEnvVar = apr_psprintf(p, "AP_PARENT_PID=%i", parent_pid);
     /*
+     * Build the environment
      * Win32's CreateProcess call requires that the environment
      * be passed in an environment block, a null terminated block of
      * null terminated strings.
      */  
+    _putenv(apr_psprintf(p,"AP_PARENT_PID=%i", parent_pid));
+    _putenv(apr_psprintf(p,"AP_MY_GENERATION=%i", ap_my_generation));
+
     i = 0;
     iEnvBlockLen = 1;
     while (_environ[i]) {
         iEnvBlockLen += strlen(_environ[i]) + 1;
         i++;
     }
-
-    pEnvBlock = (char *)apr_pcalloc(p, iEnvBlockLen + strlen(pEnvVar) + 1);
-    strcpy(pEnvBlock, pEnvVar);
-    pEnvVar = strchr(pEnvBlock, '\0') + 1;
-
+    pEnvBlock = (char *)apr_pcalloc(p, iEnvBlockLen);
+    pEnvVar = pEnvBlock;
     i = 0;
     while (_environ[i]) {
         strcpy(pEnvVar, _environ[i]);
@@ -1459,14 +1458,15 @@ static int master_main(server_rec *s, HANDLE shutdown_event, HANDLE restart_even
          * just move on with the restart.
          */
         event_handles[CHILD_HANDLE] = NULL;
-    } 
+        ++ap_my_generation;
+    }
     else {
         /* The child process exited prematurely due to a fatal error. */
         restart_pending = 1;
         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, APR_SUCCESS, ap_server_conf, 
                      "Parent: CHILD PROCESS FAILED -- Restarting the child process.");
-
         event_handles[CHILD_HANDLE] = NULL;
+        ++ap_my_generation;
     }
 
 die_now:
@@ -1982,6 +1982,7 @@ AP_DECLARE(int) ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s )
             }
         }
         else {
+            ap_my_generation = atoi(getenv("AP_MY_GENERATION"));
             get_listeners_from_parent(ap_server_conf);
         }
         if (!set_listeners_noninheritable(pconf)) {