httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruediger Pluem <>
Subject Re: PR45605 and event MPM
Date Thu, 09 Oct 2008 21:29:42 GMT

On 10/09/2008 10:53 PM, Greg Ames wrote:
> On Tue, Oct 7, 2008 at 7:03 PM, Ruediger Pluem <> wrote:
>> I am currently looking at PR45605 (
>> and the analysis and the resulting patch in Comment 4 look good to me
>> ( As worker
>> and event MPM
>> are very similar I had a look if and how this patch is applicable to the
>> event MPM.
>> I noticed that ap_queue_info_wait_for_idler is quite different in worker
>> and event MPM.
> I don't think the problem reported by PR45605 exists in the Event MPM.
> I had to stare at ap_queue_info_wait_for_idler for a long time back when it
> could be called by two separate threads.  The unserialized access to
> queue_info->idlers followed by the unconditional decrement outside of the
> mutex in that section of code made my head twitch when I thought about races
> on SMP systems.
> The two major improvements in Event's fdqueue are:
> * doing the atomic decrement first before making a decision about waiting.
> The decrement is visible to other threads immediately.
> * using the negative value of idlers to distinguish between when threads
> (just the listener today) are waiting for idle workers vs. when all workers
> are busy but nobody else (the listener) is blocked.  That eliminates a
> situation where the condition variable is signalled unnecessarily, which
> happens in the PR scenario.

Thanks for checking the code again Greg. I also went through it again and agree
that the situation described in the PR does not result in any harmful behaviour
but that the correct thing is done. As event and worker are still very similar
I would tend to copy ap_queue_info_wait_for_idler and ap_queue_info_set_idle
from event over to worker to use the same code for both which should make maintaining
easier. Does anybody see problems with this or are we still too worried about
the correct handling of signed vs. unsigned variables by apr_atomic_XXXX
to use this in a non experimental MPM?



View raw message