You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by pq...@apache.org on 2007/08/21 00:11:01 UTC

svn commit: r567852 - /httpd/httpd/trunk/server/mpm/experimental/event/event.c

Author: pquerna
Date: Mon Aug 20 15:11:00 2007
New Revision: 567852

URL: http://svn.apache.org/viewvc?rev=567852&view=rev
Log:
Rework locking on timeout_mutex.  We now drop (and reaquire) the lock inside the while loops.  This is the least line of code changes to stop a dead lock between the queue in push2worker (a blocking function) and the timeout_mutex.  These two timeout list iterations should be rewritten with better locking rules, but for now this should fix the bug, without rewriting the entire function.
PR: 41712

Modified:
    httpd/httpd/trunk/server/mpm/experimental/event/event.c

Modified: httpd/httpd/trunk/server/mpm/experimental/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/experimental/event/event.c?rev=567852&r1=567851&r2=567852&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/experimental/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/experimental/event/event.c Mon Aug 20 15:11:00 2007
@@ -1076,6 +1076,7 @@
             cs->state = CONN_STATE_LINGER;
 
             APR_RING_REMOVE(cs, timeout_list);
+            apr_thread_mutex_unlock(timeout_mutex);
 
             rc = push2worker(&cs->pfd, event_pollset);
 
@@ -1088,6 +1089,7 @@
                  */
             }
             have_idle_worker = 0;
+            apr_thread_mutex_lock(timeout_mutex);
             cs = APR_RING_FIRST(&keepalive_timeout_head);
         }
 
@@ -1099,11 +1101,14 @@
 
             cs->state = CONN_STATE_LINGER;
             APR_RING_REMOVE(cs, timeout_list);
+            apr_thread_mutex_unlock(timeout_mutex);
+
             rc = push2worker(&cs->pfd, event_pollset);
             if (rc != APR_SUCCESS) {
                 return NULL;
             }
             have_idle_worker = 0;
+            apr_thread_mutex_lock(timeout_mutex);
             cs = APR_RING_FIRST(&timeout_head);
         }