From f03a8b36dadbbfeeb5138c701cde61450b5ffee6 Mon Sep 17 00:00:00 2001 From: Paul Querna Date: Mon, 20 Aug 2007 22:11:00 +0000 Subject: [PATCH] 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 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@567852 13f79535-47bb-0310-9956-ffa450edef68 --- server/mpm/experimental/event/event.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/mpm/experimental/event/event.c b/server/mpm/experimental/event/event.c index febdd78b0b..abee41be8c 100644 --- a/server/mpm/experimental/event/event.c +++ b/server/mpm/experimental/event/event.c @@ -1076,6 +1076,7 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) 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 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) */ } have_idle_worker = 0; + apr_thread_mutex_lock(timeout_mutex); cs = APR_RING_FIRST(&keepalive_timeout_head); } @@ -1099,11 +1101,14 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) 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); } -- 2.40.0