Subject: Re: proposed fix for pthread_kill() of a zombie thread.
To: Chuck Silvers <chuq@chuq.com>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-userlevel
Date: 10/09/2005 14:07:35
Chuck Silvers <chuq@chuq.com> writes:

> I was experimenting with apache's "worker" MPM and I saw that under
> heavy load ("ab -c 1000") httpd would die with an internal assertion.
> the problem is that the web server was pthread_kill()ing a thread
> which had already pthread_exit()ed but had not yet been pthread_join()ed.
> a simple test program reproduces this.
> 
> the attached patch fixes this by simply ignoring signals sent to
> zombie threads.   anyone see any problem with this?

Looks good to me. I bet there are a couple of other places that don't
correctly handly PT_STATE_ZOMBIE... pthread_suspend_np() looks
problematic, for example.

        - Nathan