httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: [Fwd: [Patch]: Scoreboard as linked list.]
Date Mon, 06 Aug 2001 15:29:49 GMT
On Monday 06 August 2001 08:07, Greg Ames wrote:
> Ryan Bloom wrote:
> > 2)  I may be wrong, but I believe we have a race-condition. 
> > find_child_by_pid walks the scoreboard without locking it.  Since we call
> > that function from the parent whenever a child process dies, this looks
> > like a chance for a seg fault, but I am still trying to figure out what I
> > am missing.  Rather than continue to look for my misunderstanding, can
> > somebody explain it to me?
>
> [disclosure: I haven't reviewed the patch, but think I understand the
> concept]
>
> Is this really a bug?  I would think the list updates always happen in
> the single threaded parent process, and not in anything asychronous
> (like a signal handler).  If that's true, why would any other code
> called synchronously from the parent need to hold the lock?

Yes, this is a bug.  As I have tried to explain, anytime you want to walk the entire linked
list,
you MUST lock it.  You have no idea what the child processes are doing.

Based on my reading of the patch, we update the worker_score->next pointer in
ap_obtain_free_process, which is called from child_main.  Therefore, updates happen
throughout the code, and all walks require a lock.

Ryan
_____________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
Covalent Technologies			rbb@covalent.net
-----------------------------------------------------------------------------

Mime
View raw message