httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r1526220 - in /httpd/httpd/trunk: CHANGES server/mpm/worker/worker.c
Date Wed, 25 Sep 2013 16:23:29 GMT
Author: trawick
Date: Wed Sep 25 16:23:28 2013
New Revision: 1526220

URL: http://svn.apache.org/r1526220
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.

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

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1526220&r1=1526219&r2=1526220&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Wed Sep 25 16:23:28 2013
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) worker MPM: Don't forcibly kill worker threads if the child process is
+     exiting gracefully.  [Oracle Corporation]
+
   *) mod_proxy: Add ap_connection_reusable() for checking if a connection
      is reusable as of this point in processing.  [Jeff Trawick]
 

Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1526220&r1=1526219&r2=1526220&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Wed Sep 25 16:23:28 2013
@@ -1129,7 +1129,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;
@@ -1173,12 +1174,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) {
@@ -1324,7 +1327,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
@@ -1364,7 +1367,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_MPM_PODX_GRACEFUL ? ST_GRACEFUL : ST_UNGRACEFUL);
     }
 
     free(threads);



Mime
View raw message