]> granicus.if.org Git - apache/commitdiff
worker MPM: Don't forcibly kill worker threads if the child process is
authorRainer Jung <rjung@apache.org>
Thu, 3 Oct 2013 18:35:41 +0000 (18:35 +0000)
committerRainer Jung <rjung@apache.org>
Thu, 3 Oct 2013 18:35:41 +0000 (18:35 +0000)
exiting gracefully.

Submitted by: Oracle, via trawick

This modification was made some years ago for Oracle HTTP Server
by an Oracle employee.

Proposed by: trawick
Reviewed by: jim, rjung

Backport of r1526220 from trunk.

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

CHANGES
STATUS
server/mpm/worker/worker.c

diff --git a/CHANGES b/CHANGES
index 7ea92505959f3d852e5b465a6ab5022c3b1424f2..e971f861a7d91210499be38d9053c73f3b967fd4 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@
 
 Changes with Apache 2.4.7
 
+  *) worker MPM: Don't forcibly kill worker threads if the child process is
+     exiting gracefully.  [Oracle Corporation]
+
   *) core: apachectl -S prints wildcard name-based virtual hosts twice. 
      PR54948 [Eric Covener]
 
diff --git a/STATUS b/STATUS
index bfa98e64720799959705101f8498474bacb33e01..94ca7c21c11b4b9521cabc78cb12f7a281cc110e 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -97,12 +97,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  * worker MPM: Don't forcibly kill worker threads if the child process is
-    exiting gracefully.
-    trunk: http://svn.apache.org/r1526220
-    2.4.x: http://people.apache.org/~trawick/r1526220-2.4.x.txt
-    +1: trawick, jim, rjung
-
   * ab: Add wait time, fix processing time, make write errors output conditional
     trunk: http://svn.apache.org/viewvc?view=revision&revision=1488471
     2.4.x: trunk patch works (minus CHANGES)
index 4d7a92a7185db73c7190d5e7a351170cd8420f02..8712e2fb9b72c6015ece4cc4142ee028b147c8da 100644 (file)
@@ -1130,7 +1130,8 @@ static void * APR_THREAD_FUNC start_threads(apr_thread_t *thd, void *dummy)
     return NULL;
 }
 
-static void join_workers(apr_thread_t *listener, apr_thread_t **threads)
+static void join_workers(apr_thread_t *listener, apr_thread_t **threads,
+                         int mode)
 {
     int i;
     apr_status_t rv, thread_rv;
@@ -1174,12 +1175,14 @@ static void join_workers(apr_thread_t *listener, apr_thread_t **threads)
 
     for (i = 0; i < threads_per_child; i++) {
         if (threads[i]) { /* if we ever created this thread */
+            if (mode != ST_GRACEFUL) {
 #ifdef HAVE_PTHREAD_KILL
-            apr_os_thread_t *worker_os_thread;
+                apr_os_thread_t *worker_os_thread;
 
-            apr_os_thread_get(&worker_os_thread, threads[i]);
-            pthread_kill(*worker_os_thread, WORKER_SIGNAL);
+                apr_os_thread_get(&worker_os_thread, threads[i]);
+                pthread_kill(*worker_os_thread, WORKER_SIGNAL);
 #endif
+            }
 
             rv = apr_thread_join(&thread_rv, threads[i]);
             if (rv != APR_SUCCESS) {
@@ -1325,7 +1328,7 @@ static void child_main(int child_num_arg)
          *   If the worker hasn't exited, then this blocks until
          *   they have (then cleans up).
          */
-        join_workers(ts->listener, threads);
+        join_workers(ts->listener, threads, ST_UNGRACEFUL);
     }
     else { /* !one_process */
         /* remove SIGTERM from the set of blocked signals...  if one of
@@ -1365,7 +1368,8 @@ static void child_main(int child_num_arg)
          *   If the worker hasn't exited, then this blocks until
          *   they have (then cleans up).
          */
-        join_workers(ts->listener, threads);
+        join_workers(ts->listener, threads,
+                     rv == AP_GRACEFUL ? ST_GRACEFUL : ST_UNGRACEFUL);
     }
 
     free(threads);