The threaded MPM should use the POD calls from mpm_common.c, but they were
added after the threaded MPM was written, and I never bothered to port
it when I wrote the pod code.
Ryan
On Wed, 11 Jul 2001, Justin Erenkrantz wrote:
> I'd wager that threaded MPM should probably use the calls in
> mpm_common.c. But, maybe there is a reason that it doesn't.
> It's 1AM here. I've been staring at this code all night. My brain
> isn't working too well right now. (My whiteboard is covered with notes
> about threaded MPM.)
>
> Anyway, consider the following case in the threaded MPM:
>
> - parent writes a ! to the POD signaling ONE child process to die
> - around line 585, ALL of the children processes pick up on this write
> via select
> - a representative thread for each child process now calls c_p_o_d
> (if not more than one thread).
> - Acquires a mutex (locking all other threads in same process, but not
> the other processes - not a big deal - just keep that in mind...).
> - One of the children (with the lock per process) calls apr_recv and is
> the lucky winner who receives the !. He and all of his sibling
> worker threads now need to exit (since workers_may_exit is defined
> for that process and should be).
>
> Now, what about the other child processes that *shouldn't* exit?
> They potentially received the select as well - they are going to do
> the apr_recv. They won't receive EAGAIN, but rather it'll be
> returned with n == 0. But, we don't check for that - so, all of
> those threads in that other process now exits (workers_may_exit now
> defined). Oops.
>
> I've got a local program that does a bunch of forks with pipe reads
> with one writer to prove that EAGAIN isn't returned - just that the
> length is 0 when there is nothing more to be read at that point.
>
> My thought is this patch needs to be applied. Similar logic to this
> is in ap_mpm_pod_check (len == 1). This may fix some of the
> wackiness seen with threaded MPM, if I'm right (I may well not be
> right). Thoughts? -- justin
>
> P.S. What is supposed to happen when APR_FILES_AS_SOCKETS is not
> defined? Threaded MPM would never read the POD?
>
> Index: threaded.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/server/mpm/threaded/threaded.c,v
> retrieving revision 1.44
> diff -u -r1.44 threaded.c
> --- threaded.c 2001/07/03 13:58:10 1.44
> +++ threaded.c 2001/07/11 07:44:30
> @@ -511,7 +511,9 @@
> else {
> /* It won the lottery (or something else is very
> * wrong). Embrace death with open arms. */
> - workers_may_exit = 1;
> + /* Only if we read a character can we exit. */
> + if (n == 1)
> + workers_may_exit = 1;
> }
> }
> apr_lock_release(pipe_of_death_mutex);
>
>
>
_____________________________________________________________________________
Ryan Bloom [EMAIL PROTECTED]
Covalent Technologies [EMAIL PROTECTED]
-----------------------------------------------------------------------------