You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rp...@apache.org on 2008/10/18 12:19:33 UTC

svn commit: r705872 - in /httpd/httpd/branches/2.2.x: CHANGES STATUS server/mpm/worker/fdqueue.c

Author: rpluem
Date: Sat Oct 18 03:19:32 2008
New Revision: 705872

URL: http://svn.apache.org/viewvc?rev=705872&view=rev
Log:
Merge r702867 from trunk:

* 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

Modified:
    httpd/httpd/branches/2.2.x/CHANGES
    httpd/httpd/branches/2.2.x/STATUS
    httpd/httpd/branches/2.2.x/server/mpm/worker/fdqueue.c

Modified: httpd/httpd/branches/2.2.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/CHANGES?rev=705872&r1=705871&r2=705872&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.2.x/CHANGES [utf-8] Sat Oct 18 03:19:32 2008
@@ -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
 

Modified: httpd/httpd/branches/2.2.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/STATUS?rev=705872&r1=705871&r2=705872&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/STATUS (original)
+++ httpd/httpd/branches/2.2.x/STATUS Sat Oct 18 03:19:32 2008
@@ -85,16 +85,6 @@
 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 ]

Modified: httpd/httpd/branches/2.2.x/server/mpm/worker/fdqueue.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.2.x/server/mpm/worker/fdqueue.c?rev=705872&r1=705871&r2=705872&view=diff
==============================================================================
--- httpd/httpd/branches/2.2.x/server/mpm/worker/fdqueue.c (original)
+++ httpd/httpd/branches/2.2.x/server/mpm/worker/fdqueue.c Sat Oct 18 03:19:32 2008
@@ -155,7 +155,15 @@
          * 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 @@
          *     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) {