httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <>
Subject Re: Segfaults restarting on Linux with worker MPM
Date Tue, 16 Apr 2002 18:41:44 GMT
Jeff Trawick <> writes:

> Cliff Woolley <> writes:
> > On 15 Apr 2002, Jeff Trawick wrote:
> > 
> > > But if I make a change to worker to get rid of the
> > > apr_bucket_alloc_destroy() I can't reproduce the problem.
> > >
> > > What is happening is that the thread's pool is getting cleaned up
> > > before the thread goes away (baaaad) since the thread pool is a
> > > subpool of pchild and pchild can go away before the thread with a
> > > graceful restart.
> > 
> > Wow, that's funky.  Sheesh.
> Actually the code doesn't bear that out for a graceful restart
> (sequence of cleaning up pchild vs. thread)...  It is a non-graceful
> restart where child_main() exits without caring what the threads are
> doing.  Back to the drawing board (this time with a debugger). 

After another bit of debugging: 

An easy way for me to recreate the segfault on AIX is to send SIGUSR1
followed by SIGTERM while the server is processing requests.

I changed clean_child_exit() to clear pchild before it does
apr_pool_destroy() on it.  In cores for the apr_bucket_alloc_destroy()
segfault, pchild is already cleared, which means that cleanup on
pchild has already started.

Justin, if you are able to get coredumps for your problem, can you
change clean_child_exit to zap pchild before doing the pool-destroy,
and then see if pchild is already NULL when you segfault?


These facts are in conflict:

1) thread pool for worker threads is a subpool of pchild
2) pchild can be cleaned up before worker threads go away

Should APR require that the pool passed to apr_thread_create() live
until after threads exit, or should APR make the thread pool an
independent pool which won't be cleaned up with the pool passed to

The whole non-graceful termination scenario when there are multiple
threads seems ripe for problems.  We want to be able to run cleanups
for pools, but we would like worker threads to simply vanish instead
of segfaulting because the main thread has already cleaned up some
resource.  But threads don't vanish (portably).

Jeff Trawick |
Born in Roswell... married an alien...

View raw message