You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Tom Harrington <tp...@crosstor.com> on 1999/12/17 23:38:36 UTC
#ifdef MULTITHREAD in 1.3.9
I'd appreciate a bit of clarification on MULTITHREAD in 1.3.9.
I understand that the parent process starts a child process, which in
turn starts a bunch of threads to handle requests. But while I can
see where the parent watches to see if the child dies, I can't see
anywhere that the child keeps track of whether its worker threads
are still running. Although worker_main() records worker thread
info in the child_handles array, it doesn't seem to use this
information except at shutdown. Is there some detail I'm missing
where this is handled, or does the MULTITHREAD code simply assume
that none of the worker threads will unexpectedly exit?
I know that this code is pretty Windows-specific, but some details of
the approach will be useful in the port I'm doing.
--
Tom Harrington
CrosStor Software, Inc.
tph@crosstor.com
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Manoj Kasichainula <ma...@io.com>.
On Wed, Dec 22, 1999 at 12:47:03PM +0000, Ben Laurie wrote:
> Manoj Kasichainula wrote:
> > How about if we just use SIGEV_THREAD to receive the signal where
> > possible, and use sigwait where it's not available.
>
> I dunno - SIGEV_THREAD is not within my ken. What is it?
It's an argument to sigaction, which tells the system to start a new
thread for the signal handler. AFAICT, the new thread is not subject
to all the restrictions that a normal signal handler is (such as not
running any interesting pthread calls), so we can actually run the
pool cleanup routines and exit properly.
SIGEV_THREAD is required by the pthread spec, but it was added at the
very last minute, so even many "pthread-compliant" OSes don't support
it. Linux allegedly does.
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Ben Laurie <be...@algroup.co.uk>.
Manoj Kasichainula wrote:
>
> On Mon, Dec 20, 1999 at 10:20:18PM +0000, Ben Laurie wrote:
> > I would say that it is perfectly acceptable to test for the buggy
> > version of the OS, and refuse to go, or at least squeak loudly, unless
> > there's a compelling reason that people shouldn't upgrade.
>
> How about if we just use SIGEV_THREAD to receive the signal where
> possible, and use sigwait where it's not available. This will work
> around the bug on Linux, and is actually better on the platforms that
> support SIGEV_THREAD (in theory, all pthreads-compliant systems).
I dunno - SIGEV_THREAD is not within my ken. What is it?
Cheers,
Ben.
--
SECURE HOSTING AT THE BUNKER! http://www.thebunker.net/hosting.htm
http://www.apache-ssl.org/ben.html
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Manoj Kasichainula <ma...@io.com>.
On Mon, Dec 20, 1999 at 10:20:18PM +0000, Ben Laurie wrote:
> I would say that it is perfectly acceptable to test for the buggy
> version of the OS, and refuse to go, or at least squeak loudly, unless
> there's a compelling reason that people shouldn't upgrade.
How about if we just use SIGEV_THREAD to receive the signal where
possible, and use sigwait where it's not available. This will work
around the bug on Linux, and is actually better on the platforms that
support SIGEV_THREAD (in theory, all pthreads-compliant systems).
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Ben Laurie <be...@algroup.co.uk>.
Ryan Bloom wrote:
>
> > > It doesn't matter if this is a bug or not, we need to deal with it.
> >
> > Well, yeah. The point was that before 2.0 is released, I (or hopefully
> > someone else :) intend to fix Linux's behavior, one way or the other.
>
> But that's my point. We can't fix it one way or the other. We need to
> fix it in Apache, because fixing it in Linux, doesn't fix any of the older
> systems that don't have this fix.
I would say that it is perfectly acceptable to test for the buggy
version of the OS, and refuse to go, or at least squeak loudly, unless
there's a compelling reason that people shouldn't upgrade.
Cheers,
Ben.
--
SECURE HOSTING AT THE BUNKER! http://www.thebunker.net/hosting.htm
http://www.apache-ssl.org/ben.html
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Ryan Bloom <rb...@raleigh.ibm.com>.
> > It doesn't matter if this is a bug or not, we need to deal with it.
>
> Well, yeah. The point was that before 2.0 is released, I (or hopefully
> someone else :) intend to fix Linux's behavior, one way or the other.
But that's my point. We can't fix it one way or the other. We need to
fix it in Apache, because fixing it in Linux, doesn't fix any of the older
systems that don't have this fix.
Ryan
_______________________________________________________________________
Ryan Bloom rbb@raleigh.ibm.com
4205 S Miami Blvd
RTP, NC 27709
Come to the first official Apache Software Foundation
Conference! <http://ApacheCon.Com/>
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Manoj Kasichainula <ma...@io.com>.
On Mon, Dec 20, 1999 at 03:37:45PM -0500, Ryan Bloom wrote:
>
> It doesn't matter if this is a bug or not, we need to deal with it.
Well, yeah. The point was that before 2.0 is released, I (or hopefully
someone else :) intend to fix Linux's behavior, one way or the other.
> I don't really care which, because I am
> assuming that a SIGSEGV in a linux thread is relatively safe to continue
> executing through.
No, not really, for the same reason that it's dangerous to do so on a
standard threaded system. Memory and other resources are probably
corrupted.
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Ben Laurie <be...@algroup.co.uk>.
Manoj Kasichainula wrote:
>
> On Mon, Dec 20, 1999 at 12:39:02PM -0500, Ryan Bloom wrote:
> > The only real reason for a thread to die unexpectedly, is a seg
> > fault, and that should take down the whole process. The one OS I
> > can think of where this isn't true, is Linux, because threads and
> > processes are equivalent.
>
> Well, yeah, but this is really a bug.
If true, doubleplusone.
Cheers,
Ben.
--
SECURE HOSTING AT THE BUNKER! http://www.thebunker.net/hosting.htm
http://www.apache-ssl.org/ben.html
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Ryan Bloom <rb...@raleigh.ibm.com>.
It doesn't matter if this is a bug or not, we need to deal with it. If a
SIGSEGV doesn't take down the whole process, we need to either take it
down, or spawn a new thread. I don't really care which, because I am
assuming that a SIGSEGV in a linux thread is relatively safe to continue
executing through. I am not saying this needs to be fixed ASAP, but we do
need to fix it before we release Apache 2.0. We need to treat this just
like any other broken OS, and work around the problem. The OS may be
Linux, but that doesn't mean it isn't broken, not taking down a process
when a thread SEGV's is broken, and we can't assume people are going to
upgrade their pthreads packages just because a new one is released.
Ryan
> Well, yeah, but this is really a bug. SIGSEGV is supposed to kill the
> whole process, but I think I found a bug which makes Linux break this
> rule. I got no response when I complained last month, but I haven't
> pushed very hard yet.
>
> Manoj
>
_______________________________________________________________________
Ryan Bloom rbb@raleigh.ibm.com
4205 S Miami Blvd
RTP, NC 27709
Come to the first official Apache Software Foundation
Conference! <http://ApacheCon.Com/>
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Manoj Kasichainula <ma...@io.com>.
On Mon, Dec 20, 1999 at 12:39:02PM -0500, Ryan Bloom wrote:
> The only real reason for a thread to die unexpectedly, is a seg
> fault, and that should take down the whole process. The one OS I
> can think of where this isn't true, is Linux, because threads and
> processes are equivalent.
Well, yeah, but this is really a bug. SIGSEGV is supposed to kill the
whole process, but I think I found a bug which makes Linux break this
rule. I got no response when I complained last month, but I haven't
pushed very hard yet.
Manoj
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Ryan Bloom <rb...@raleigh.ibm.com>.
> Given that Linux/Apache seems to be a popular combination, might it
> make sense to add some sort of thread monitoring? It might be that
> the proper response to an unexpected thread exit on Linux is to
> take down the process that started the threads (forcing a restart).
> But if a thread can exit without being detected and/or causing a
> restart, there's the possibility of the server gradually dying off
> through undetected thread death.
The question is how to go about doing this. For right now, it isn't a
real issue, because we aren't even at the beta stage of Apache 2.0. When
we finalize a bit more, we can deal with this issue better. We need to
actually get working code for more modules, and determine if this is a
real issue. It may be that Linux's monitor thread does notice a sigsegv
and does shutdown the process properly, I don't know off the top of my
head, and I haven't check recently.
Ryan
_______________________________________________________________________
Ryan Bloom rbb@raleigh.ibm.com
4205 S Miami Blvd
RTP, NC 27709
Come to the first official Apache Software Foundation
Conference! <http://ApacheCon.Com/>
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Tom Harrington <tp...@crosstor.com>.
Ryan Bloom wrote:
>
> > > We assume that none of the threads should die. I need to look at the code to
> > > be sure, but I think if a thread exits, it will cause the entire child
> > > process to exit (and be restarted by the parent).
> >
> > Oh, I see. That'd be a Win32-specific detail that I was unaware of.
> > If true then this approach makes sense. Thanks.
>
> I think for the most part, we assume on all platforms that if a thread
> exits for an unknown reason, the whole process will be going down. The
> only real reason for a thread to die unexpectedly, is a seg fault, and
> that should take down the whole process. The one OS I can think of where
> this isn't true, is Linux, because threads and processes are equivalent.
Given that Linux/Apache seems to be a popular combination, might it
make sense to add some sort of thread monitoring? It might be that
the proper response to an unexpected thread exit on Linux is to
take down the process that started the threads (forcing a restart).
But if a thread can exit without being detected and/or causing a
restart, there's the possibility of the server gradually dying off
through undetected thread death.
--
Tom Harrington
CrosStor Software, Inc.
tph@crosstor.com
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Ben Laurie <be...@algroup.co.uk>.
Ryan Bloom wrote:
>
> > > We assume that none of the threads should die. I need to look at the code to
> > > be sure, but I think if a thread exits, it will cause the entire child
> > > process to exit (and be restarted by the parent).
> >
> > Oh, I see. That'd be a Win32-specific detail that I was unaware of.
> > If true then this approach makes sense. Thanks.
>
> I think for the most part, we assume on all platforms that if a thread
> exits for an unknown reason, the whole process will be going down. The
> only real reason for a thread to die unexpectedly, is a seg fault, and
> that should take down the whole process. The one OS I can think of where
> this isn't true, is Linux, because threads and processes are equivalent.
Not! They may share code like crazy, but they are not equivalent.
Cheers,
Ben.
--
SECURE HOSTING AT THE BUNKER! http://www.thebunker.net/hosting.htm
http://www.apache-ssl.org/ben.html
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."
- Indira Gandhi
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Ryan Bloom <rb...@raleigh.ibm.com>.
> > We assume that none of the threads should die. I need to look at the code to
> > be sure, but I think if a thread exits, it will cause the entire child
> > process to exit (and be restarted by the parent).
>
> Oh, I see. That'd be a Win32-specific detail that I was unaware of.
> If true then this approach makes sense. Thanks.
I think for the most part, we assume on all platforms that if a thread
exits for an unknown reason, the whole process will be going down. The
only real reason for a thread to die unexpectedly, is a seg fault, and
that should take down the whole process. The one OS I can think of where
this isn't true, is Linux, because threads and processes are equivalent.
And possibly OS/2, where I think we are trapping the SIGSEGV and just
terminating the offending thread.
All of this applies to Apache 2.0
Ryan
_______________________________________________________________________
Ryan Bloom rbb@raleigh.ibm.com
4205 S Miami Blvd
RTP, NC 27709
Come to the first official Apache Software Foundation
Conference! <http://ApacheCon.Com/>
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Tom Harrington <tp...@crosstor.com>.
Bill Stoddard wrote:
>
> ----- Original Message -----
> From: "Tom Harrington" <tp...@crosstor.com>
> To: <ne...@apache.org>
> Sent: Friday, December 17, 1999 5:38 PM
> Subject: #ifdef MULTITHREAD in 1.3.9
>
> > I'd appreciate a bit of clarification on MULTITHREAD in 1.3.9.
> >
> > I understand that the parent process starts a child process, which in
> > turn starts a bunch of threads to handle requests. But while I can
> > see where the parent watches to see if the child dies, I can't see
> > anywhere that the child keeps track of whether its worker threads
> > are still running.
> We assume that none of the threads should die. I need to look at the code to
> be sure, but I think if a thread exits, it will cause the entire child
> process to exit (and be restarted by the parent).
Oh, I see. That'd be a Win32-specific detail that I was unaware of.
If true then this approach makes sense. Thanks.
--
Tom Harrington
CrosStor Software, Inc.
tph@crosstor.com
Re: #ifdef MULTITHREAD in 1.3.9
Posted by Bill Stoddard <st...@raleigh.ibm.com>.
----- Original Message -----
From: "Tom Harrington" <tp...@crosstor.com>
To: <ne...@apache.org>
Sent: Friday, December 17, 1999 5:38 PM
Subject: #ifdef MULTITHREAD in 1.3.9
> I'd appreciate a bit of clarification on MULTITHREAD in 1.3.9.
>
> I understand that the parent process starts a child process, which in
> turn starts a bunch of threads to handle requests. But while I can
> see where the parent watches to see if the child dies, I can't see
> anywhere that the child keeps track of whether its worker threads
> are still running.
We assume that none of the threads should die. I need to look at the code to
be sure, but I think if a thread exits, it will cause the entire child
process to exit (and be restarted by the parent).
Bill Stoddard
Come to the first official Apache Software Foundation
Conference! <http://ApacheCon.Com/>