On Mon, Jul 30, 2001 at 11:56:23PM -0400, Greg Ames wrote:
> >  Justin's patch of two mutexes did fix the problem, but I do not see it being 
>included
> >  even now.
> 
> Either I deleted that one, or I can't figure out which one it is amongst
> the others.  Justin, could you please re-post this one?

Yeah, I have lots of patches flying around.  Sorry about that.

It'd look something like this (I seem to have lost my local copy).  This 
would solve the shutdown problems that rbb and I have brought up.  But, 
you now introduce the single-listener model to the threaded MPM - which
is designed to be multiple-listeners.

If you can address the shutdown concerns when you have multiple
listeners, I'm all ears.  Until then, IMHO, you're better off going 
to a true single-listener MPM (aka worker MPM).  The multiple listener
model has too many shutdown problems.

> and does anyone know where the new-httpd mail archive lives any more?

You can always try out http://www.apachelabs.org  -- justin

Index: threaded.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm/threaded/threaded.c,v
retrieving revision 1.53
diff -u -r1.53 threaded.c
--- threaded.c  2001/07/31 06:22:32     1.53
+++ threaded.c  2001/07/31 06:28:44
@@ -182,6 +182,7 @@
 static apr_lock_t *accept_mutex;
 static apr_lockmech_e_np accept_lock_mech = APR_LOCK_DEFAULT;
 static const char *lock_fname;
+static apr_lock_t *worker_accept_mutex;
 
 #ifdef NO_SERIALIZED_ACCEPT
 #define SAFE_ACCEPT(stmt) APR_SUCCESS
@@ -556,13 +557,20 @@
 
         (void) ap_update_child_status(process_slot, thread_slot, SERVER_READY, 
                                       (request_rec *) NULL);
-        if ((rv = SAFE_ACCEPT(apr_lock_acquire(accept_mutex)))
-            != APR_SUCCESS) {
+        if ((rv = apr_lock_acquire(worker_accept_mutex) != APR_SUCCESS))
+        {
             ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                          "apr_lock_acquire failed. Attempting to shutdown "
                          "process gracefully.");
             workers_may_exit = 1;
         }
+        if (!workers_may_exit && 
+            (rv = SAFE_ACCEPT(apr_lock_acquire(accept_mutex))) != APR_SUCCESS) {
+            ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
+                         "apr_lock_acquire failed. Attempting to shutdown "
+                         "process gracefully.");
+            workers_may_exit = 1;
+        }
 
         while (!workers_may_exit) {
            apr_status_t ret;
@@ -627,6 +635,12 @@
                              "process gracefully.");
                 workers_may_exit = 1;
             }
+            if ((rv = apr_lock_release(worker_accept_mutex)) != APR_SUCCESS) {
+                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
+                             "apr_lock_release failed. Attempting to shutdown "
+                             "process gracefully.");
+                workers_may_exit = 1;
+            }
             if (csd != NULL) {
                 process_socket(ptrans, csd, process_slot, thread_slot);
                 requests_this_child--;
@@ -640,6 +654,12 @@
                              "process gracefully.");
                 workers_may_exit = 1;
             }
+            if ((rv = apr_lock_release(worker_accept_mutex)) != APR_SUCCESS) {
+                ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
+                             "apr_lock_release failed. Attempting to shutdown "
+                             "process gracefully.");
+                workers_may_exit = 1;
+            }
             break;
         }
         apr_pool_clear(ptrans);
@@ -814,6 +834,8 @@
     apr_lock_create(&worker_thread_count_mutex, APR_MUTEX, APR_INTRAPROCESS,
                     NULL, pchild);
     apr_lock_create(&pipe_of_death_mutex, APR_MUTEX, APR_INTRAPROCESS, 
+                    NULL, pchild);
+    apr_lock_create(&worker_accept_mutex, APR_MUTEX, APR_INTRAPROCESS,
                     NULL, pchild);
 
     ts = apr_palloc(pchild, sizeof(*ts));

Reply via email to