You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rj...@apache.org on 2013/10/03 20:35:42 UTC

svn commit: r1528962 - in /httpd/httpd/branches/2.4.x: CHANGES STATUS server/mpm/worker/worker.c

Author: rjung
Date: Thu Oct  3 18:35:41 2013
New Revision: 1528962

URL: http://svn.apache.org/r1528962
Log:
worker MPM: Don't forcibly kill worker threads if the child process is
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.

Modified:
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/STATUS
    httpd/httpd/branches/2.4.x/server/mpm/worker/worker.c

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1528962&r1=1528961&r2=1528962&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Thu Oct  3 18:35:41 2013
@@ -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]
 

Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1528962&r1=1528961&r2=1528962&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Thu Oct  3 18:35:41 2013
@@ -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)

Modified: httpd/httpd/branches/2.4.x/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/mpm/worker/worker.c?rev=1528962&r1=1528961&r2=1528962&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/mpm/worker/worker.c (original)
+++ httpd/httpd/branches/2.4.x/server/mpm/worker/worker.c Thu Oct  3 18:35:41 2013
@@ -1130,7 +1130,8 @@ static void * APR_THREAD_FUNC start_thre
     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 *l
 
     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);