]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* Event MPM: Rework locking of the timeout_mutex, to never hold it while
authorJim Jagielski <jim@apache.org>
Thu, 13 Sep 2007 12:20:04 +0000 (12:20 +0000)
committerJim Jagielski <jim@apache.org>
Thu, 13 Sep 2007 12:20:04 +0000 (12:20 +0000)
          calling blocking operations on the worker queue.
                Trunk version of patch:
                        http://svn.apache.org/viewvc?view=rev&revision=567852
                                http://svn.apache.org/viewvc?view=rev&revision=574462
                                      2.2.x version of patch:
                                              http://people.apache.org/~pquerna/event-mpm-deadlock.patch    +1: pquerna, jim, rpluem

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

STATUS
server/mpm/experimental/event/event.c

diff --git a/STATUS b/STATUS
index 97dd242b9a414a543f38505a7ce4831cc85be2e2..86278179ea2c28f330be12690524a1ea5c6e409e 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -79,14 +79,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-    * Event MPM: Rework locking of the timeout_mutex, to never hold it while
-      calling blocking operations on the worker queue.
-      Trunk version of patch:
-        http://svn.apache.org/viewvc?view=rev&revision=567852
-        http://svn.apache.org/viewvc?view=rev&revision=574462
-      2.2.x version of patch:
-        http://people.apache.org/~pquerna/event-mpm-deadlock.patch
-    +1: pquerna, jim, rpluem
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
 
index 2a6913b3c3d518621f0661d7760864ba6455bcc4..cfff13267f1dac5ca095e5c676f7f489e63fd60a 100644 (file)
@@ -1020,12 +1020,19 @@ static void *listener_thread(apr_thread_t * thd, void *dummy)
         cs = APR_RING_FIRST(&timeout_head);
         timeout_time = time_now + TIMEOUT_FUDGE_FACTOR;
         while (!APR_RING_EMPTY(&timeout_head, conn_state_t, timeout_list)
-               && cs->expiration_time < timeout_time
-               && get_worker(&have_idle_worker)) {
+               && cs->expiration_time < timeout_time) {
 
             cs->state = CONN_STATE_LINGER;
 
             APR_RING_REMOVE(cs, timeout_list);
+            apr_thread_mutex_unlock(timeout_mutex);
+
+            if (!get_worker(&have_idle_worker)) {
+                apr_thread_mutex_lock(timeout_mutex);
+                APR_RING_INSERT_HEAD(&timeout_head, cs,
+                                     conn_state_t, timeout_list);
+                break;
+            }
 
             rc = push2worker(&cs->pfd, event_pollset);
 
@@ -1038,6 +1045,7 @@ static void *listener_thread(apr_thread_t * thd, void *dummy)
                  */
             }
             have_idle_worker = 0;
+            apr_thread_mutex_lock(timeout_mutex);
             cs = APR_RING_FIRST(&timeout_head);
         }
         apr_thread_mutex_unlock(timeout_mutex);