]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r702867 from trunk:
authorRuediger Pluem <rpluem@apache.org>
Sat, 18 Oct 2008 10:19:32 +0000 (10:19 +0000)
committerRuediger Pluem <rpluem@apache.org>
Sat, 18 Oct 2008 10:19:32 +0000 (10:19 +0000)
* Recheck again if idle workers are still available when we are signaled that
  they are. This is needed since it can happen that we are signaled by a
  worker thread that went idle but received a context switch before it could
  tell us. If it does signal us later once it is on CPU again there might be
  no idle worker left. See
  https://issues.apache.org/bugzilla/show_bug.cgi?id=45605#c4

PR: 45605
Submitted by: Denis Ustimenko <denusk gmail.com>
Reviewed by: rpluem, jim, gregames

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

CHANGES
STATUS
server/mpm/worker/fdqueue.c

diff --git a/CHANGES b/CHANGES
index a73e8614b7add04de7651e6e580e24822f1f541e..98961266a97f11553854036d7a921668ba95259f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.11
 
+  *) Worker MPM: Crosscheck that idle workers are still available before using
+     them and thus preventing an overflow of the worker queue which causes
+     a SegFault. PR 45605 [Denis Ustimenko <denusk gmail.com>]
 
 Changes with Apache 2.2.10
 
diff --git a/STATUS b/STATUS
index 252b74d8dc32590fe33c5ca3628bd8a623616ca1..7898933ee9152f4afc7a4b4ec808cb4c58935d57 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -85,16 +85,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * Worker MPM: Crosscheck that idle workers are still available before using
-     them and thus preventing an overflow of the worker queue which causes
-     a SegFault.
-     PR: 45605
-     Trunk version of patch:
-        http://svn.apache.org/viewvc?rev=702867&view=rev
-     Backport version for 2.2.x of patch:
-        Trunk version of patch works
-     +1: rpluem, jim, gregames
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index d46dd5361bd765a8a1e0b80287e6605579ca1b4c..dfbe8c47cfd7df8277c7cb34ecf577beeb5b46ab 100644 (file)
@@ -155,7 +155,15 @@ apr_status_t ap_queue_info_wait_for_idler(fd_queue_info_t *queue_info,
          * region, one of two things may have happened:
          *   - If the idle worker count is still zero, the
          *     workers are all still busy, so it's safe to
-         *     block on a condition variable.
+         *     block on a condition variable, BUT
+         *     we need to check for idle worker count again
+         *     when we are signaled since it can happen that
+         *     we are signaled by a worker thread that went idle
+         *     but received a context switch before it could
+         *     tell us. If it does signal us later once it is on
+         *     CPU again there might be no idle worker left.
+         *     See
+         *     https://issues.apache.org/bugzilla/show_bug.cgi?id=45605#c4
          *   - If the idle worker count is nonzero, then a
          *     worker has become idle since the first check
          *     of queue_info->idlers above.  It's possible
@@ -166,7 +174,7 @@ apr_status_t ap_queue_info_wait_for_idler(fd_queue_info_t *queue_info,
          *     now nonzero, it's safe for this function to
          *     return immediately.
          */
-        if (queue_info->idlers == 0) {
+        while (queue_info->idlers == 0) {
             rv = apr_thread_cond_wait(queue_info->wait_for_idler,
                                   queue_info->idlers_mutex);
             if (rv != APR_SUCCESS) {