]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1757061, r1770750 from trunk:
authorJim Jagielski <jim@apache.org>
Fri, 2 Dec 2016 11:42:55 +0000 (11:42 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 2 Dec 2016 11:42:55 +0000 (11:42 +0000)
ap_reclaim_child_processes() ignores its first argument

note this in the docs, add comment

ap_reclaim_child_processes(): Implement terminate immediately

The behavior for terminate == 1 was documented but not implemented. Do
that now.

Submitted by: sf
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1772332 13f79535-47bb-0310-9956-ffa450edef68

STATUS
server/mpm_unix.c

diff --git a/STATUS b/STATUS
index dcd3489fe602d01a29d7c837537d6bd3a9c46fd3..2c55ccec64775d3760ea6593b076448c77869e75 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -117,13 +117,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) ap_reclaim_child_processes(): Implement terminate immediately
-     trunk patches:
-       https://svn.apache.org/r1757061
-       https://svn.apache.org/r1770750
-     2.4.x patch: https://people.apache.org/~sf/PR53555_1_ap_reclaim_child_processes.diff
-     +1: sf, jim, wrowe
-
   *) Improve mod_status view of async connections
      trunk patches:
        https://svn.apache.org/r1738628
index 7a1185466982165b88afa7e8052a8190e9b5d1b2..dce10a78cffbe3289a7b3edf400438331a0def5c 100644 (file)
 #undef APLOG_MODULE_INDEX
 #define APLOG_MODULE_INDEX AP_CORE_MODULE_INDEX
 
-typedef enum {DO_NOTHING, SEND_SIGTERM, SEND_SIGKILL, GIVEUP} action_t;
+typedef enum {
+    DO_NOTHING,
+    SEND_SIGTERM,
+    SEND_SIGTERM_NOLOG,
+    SEND_SIGKILL,
+    GIVEUP
+} action_t;
 
 typedef struct extra_process_t {
     struct extra_process_t *next;
@@ -142,6 +148,8 @@ static int reclaim_one_pid(pid_t pid, action_t action)
                      " still did not exit, "
                      "sending a SIGTERM",
                      pid);
+        /* FALLTHROUGH */
+    case SEND_SIGTERM_NOLOG:
         kill(pid, SIGTERM);
         break;
 
@@ -193,6 +201,7 @@ AP_DECLARE(void) ap_reclaim_child_processes(int terminate,
                           * children but take no action against
                           * stragglers
                           */
+        {SEND_SIGTERM_NOLOG, 0}, /* skipped if terminate == 0 */
         {SEND_SIGTERM, apr_time_from_sec(3)},
         {SEND_SIGTERM, apr_time_from_sec(5)},
         {SEND_SIGTERM, apr_time_from_sec(7)},
@@ -202,19 +211,21 @@ AP_DECLARE(void) ap_reclaim_child_processes(int terminate,
     int cur_action;      /* index of action we decided to take this
                           * iteration
                           */
-    int next_action = 1; /* index of first real action */
+    int next_action = terminate ? 1 : 2; /* index of first real action */
 
     ap_mpm_query(AP_MPMQ_MAX_DAEMON_USED, &max_daemons);
 
     do {
-        apr_sleep(waittime);
-        /* don't let waittime get longer than 1 second; otherwise, we don't
-         * react quickly to the last child exiting, and taking action can
-         * be delayed
-         */
-        waittime = waittime * 4;
-        if (waittime > apr_time_from_sec(1)) {
-            waittime = apr_time_from_sec(1);
+        if (action_table[next_action].action_time > 0) {
+            apr_sleep(waittime);
+            /* don't let waittime get longer than 1 second; otherwise, we don't
+             * react quickly to the last child exiting, and taking action can
+             * be delayed
+             */
+            waittime = waittime * 4;
+            if (waittime > apr_time_from_sec(1)) {
+                waittime = apr_time_from_sec(1);
+            }
         }
 
         /* see what action to take, if any */