https://bz.apache.org/bugzilla/show_bug.cgi?id=63503

--- Comment #12 from Ruediger Pluem <[email protected]> ---
For easier review the patch without whitespace changes:

Index: modules/proxy/proxy_util.c
===================================================================
--- modules/proxy/proxy_util.c  (revision 1864214)
+++ modules/proxy/proxy_util.c  (working copy)
@@ -2045,10 +2045,12 @@
                      ap_proxy_worker_name(p, worker));
     }
     else {
+        apr_global_mutex_lock(proxy_mutex);
+        /* Check again after we got the lock if we are still uninitialized */
+        if (!(worker->local_status & PROXY_WORKER_INITIALIZED)) {
         ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(00927)
                      "initializing worker %s local",
                      ap_proxy_worker_name(p, worker));
-        apr_global_mutex_lock(proxy_mutex);
         /* Now init local worker data */
 #if APR_HAS_THREADS
         if (worker->tmutex == NULL) {
@@ -2101,12 +2103,15 @@
                  "initialized single connection worker in child %"
APR_PID_T_FMT " for (%s)",
                  getpid(), worker->s->hostname_ex);
         }
+            if (rv == APR_SUCCESS) {
+                worker->local_status |= (PROXY_WORKER_INITIALIZED);
+            }
+        }
         apr_global_mutex_unlock(proxy_mutex);

     }
     if (rv == APR_SUCCESS) {
         worker->s->status |= (PROXY_WORKER_INITIALIZED);
-        worker->local_status |= (PROXY_WORKER_INITIALIZED);
     }
     return rv;
 }
Index: modules/proxy/mod_proxy.h
===================================================================
--- modules/proxy/mod_proxy.h   (revision 1864214)
+++ modules/proxy/mod_proxy.h   (working copy)
@@ -470,7 +470,7 @@
 /* Worker configuration */
 struct proxy_worker {
     proxy_hashes    hash;       /* hash of worker name */
-    unsigned int local_status;  /* status of per-process worker */
+    volatile unsigned int local_status;  /* status of per-process worker */
     proxy_conn_pool     *cp;    /* Connection pool to use */
     proxy_worker_shared   *s;   /* Shared data */
     proxy_balancer  *balancer;  /* which balancer am I in? */

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to