httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul J. Reder" <rede...@raleigh.ibm.com>
Subject Re: threaded.c assigning children to wrong slot
Date Fri, 27 Jul 2001 12:01:06 GMT
Jeff,

This is the core of Ryan's patch to fix the threaded mpm problem where
we were left with N processes each with a small number of retiring
workers due to MaxRequestsPerChild being hit. 

Ryan's fix was to allow multiple (up to ThreadsPerChild) processes to
occupy the same slot (each process overwriting the previous owners pid - even
if that pid still exists. Httpd no longer pays any attention to the
MaxClients value. In perform_idle_server_maintenance, in the inner "for" loop,
it looks to see if there are "any_dead_threads". If there are *any* dead
threads (as opposed to all dead threads) it will start a new process within
that same slot.

You can end up with a worst case scenario of (MaxClients * ThreadsPerChild)
number of processes (with ThreadsPerChild processes occupying the same slot,
where the last process into the slot is listed as the owner).

As each of these processes is started it tries to grab all the available
workers in that slot. This is why we now have the new start_threads thread.
Each new process is started in its own thread so that it can keep looping
until it eventually grabs ThreadsPerChild workers (or discovers
workers_can_exit).

The user has *no* control over how many processes get started - well, they
can limit it by defining MaxClients and ThreadsPerChild... But at least you
never end up with dead workers when there is work to do simply because we
were out of processes. The user also never gets an indication of how many
processes have been started since we don't report that in the status. Because
the pids get overridden it appears, according to status, to contain only
MaxClient pids.

So what you are seeing is just the code working as it is designed to.

-- 
Paul J. Reder
-----------------------------------------------------------
"The strength of the Constitution lies entirely in the determination of each
citizen to defend it.  Only if every single citizen feels duty bound to do
his share in this defense are the constitutional rights secure."
-- Albert Einstein

Mime
View raw message