Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-18 Thread Luke Kenneth Casson Leighton
On Tue, Jul 17, 2001 at 10:12:35AM -0700, Aaron Bannert wrote: - Optionally creating a child-pool for each thread. This provides us two things in my mind: 1) Allowing the application to choose an SMS for this thread-pool (which could very well be a special SMS created just for this

RE: [PATCH] Problems with MPM threaded

2001-07-18 Thread Benjamin W. Ritcey
: Re: [PATCH] Problems with MPM threaded On Sat, 14 Jul 2001 [EMAIL PROTECTED] wrote: Having multiple processes each with multiple threads provides for FAR more robustness than just a single process with multiple threads. ya know, i'm not really convinced of the desirability of this explanation

Re: [PATCH] Problems with MPM threaded

2001-07-17 Thread dean gaudet
On Sat, 14 Jul 2001 [EMAIL PROTECTED] wrote: Having multiple processes each with multiple threads provides for FAR more robustness than just a single process with multiple threads. ya know, i'm not really convinced of the desirability of this explanation anymore. maybe the hypothetical buggy

Re: [PATCH] Problems with MPM threaded

2001-07-17 Thread dean gaudet
On Sat, 14 Jul 2001, Roy T. Fielding wrote: The correct fix, as I see it, is to kill off the interprocess accept lock by removing the possibility of having other processes in a *threaded* MPM. -- justin That architecture was explored in detail by Netscape. It isn't reliable and

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Aaron Bannert
Normally this would be done (in POSIX) with pthread_cancel(), passing it the pthread_t from the other thread. Unfortunately, this is not a part of APR because many of the current OS implementations of this mechanism will leak resources (aparently in the kernel), and that is bad. -aaron On

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Aaron Bannert
On Tue, Jul 17, 2001 at 01:29:47AM -0700, dean gaudet wrote: On Sun, 15 Jul 2001, Sander Striker wrote: Why are we so desperate in opting out the child-pool creation? I don't really have problems with a child pool for each thread. Actually, it will make the dynamic locking a lot easier

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Aaron Bannert
Uh...you knew that already, didn't you... duh... jeez now i'm the smartass ;) -aaron On Tue, Jul 17, 2001 at 08:43:18AM -0700, Aaron Bannert wrote: Normally this would be done (in POSIX) with pthread_cancel(), passing it the pthread_t from the other thread. Unfortunately, this is not a

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread William A. Rowe, Jr.
From: [EMAIL PROTECTED] Sent: Tuesday, July 17, 2001 11:13 AM I believe that the problem is that the threaded code is creating the pool, and not advertising it to the thread itself. This is an easy thing to fix. I do not agree that every APR app that uses threads should have to create

Re: Terminating threads in a process,WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Brian Pane
William A. Rowe, Jr. wrote: From: [EMAIL PROTECTED] Sent: Tuesday, July 17, 2001 11:13 AM I believe that the problem is that the threaded code is creating the pool, and not advertising it to the thread itself. This is an easy thing to fix. I do not agree that every APR app that uses threads

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Aaron Bannert
I'm not sure that the alternative is workable, either. At the time of the fork, when the child process gets a snapshot of the parent's memory, it's possible that some thread other than the one invoking fork could be halfway through registering a new resource (e.g., file descriptor) in its

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Aaron Bannert
We have hit an impass in my mind. Dean and I are saying that having each thread have it's own pool is a requirement. Not just for httpd, but for anything using pools. Dean, if I am mis-interpreting you, then I am sorry, and please correct me. Aaron, you disagree. you want each app to

Re: Terminating threads in a process,WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Brian Pane
Aaron Bannert wrote: I'm not sure that the alternative is workable, either. At the time of the fork, when the child process gets a snapshot of the parent's memory, it's possible that some thread other than the one invoking fork could be halfway through registering a new resource (e.g., file

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Aaron Bannert
On Tue, Jul 17, 2001 at 10:17:01AM -0700, Brian Pane wrote: Aaron Bannert wrote: I'm not sure that the alternative is workable, either. At the time of the fork, when the child process gets a snapshot of the parent's memory, it's possible that some thread other than the one invoking fork

Re: Terminating threads in a process,WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Brian Pane
Aaron Bannert wrote: On Tue, Jul 17, 2001 at 10:17:01AM -0700, Brian Pane wrote: Aaron Bannert wrote: I'm not sure that the alternative is workable, either. At the time of the fork, when the child process gets a snapshot of the parent's memory, it's possible that some thread other than the

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread William A. Rowe, Jr.
From: dean gaudet [EMAIL PROTECTED] Sent: Tuesday, July 17, 2001 6:15 PM if you assume that you want some form of notification, but you want to leave it unspecified because you're not sure what each apr thread will be used for, then you can make a somewhat generic kill off other threads

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Aaron Bannert
[snip] that would be registered in the parent thread's pool -- and would only be invoked by the parent thread. pools let you do this, you don't need the mutexes for it, you just have to be explicit about parallelism. (combine that with a root pool per thread and then we can remove

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread William A. Rowe, Jr.
From: Aaron Bannert [EMAIL PROTECTED] Sent: Tuesday, July 17, 2001 6:41 PM [snip] that would be registered in the parent thread's pool -- and would only be invoked by the parent thread. pools let you do this, you don't need the mutexes for it, you just have to be explicit about

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-17 Thread Aaron Bannert
I totally agree, but only as a solution in httpd. no, everywhere. I also believe that we should provide this [application-specific requirement] outside of the basic thread support in APR. Please allow me to use pseudocode: void * worker_function(void * opaque_application_data)

Re: [PATCH] Problems with MPM threaded

2001-07-17 Thread Roy T. Fielding
That architecture was explored in detail by Netscape. It isn't reliable and slows your web server to a crawl whenever dynamic content is produced. It should only be used for static file servers and caching gateways, and people implementing those might as well use an in-kernel server like

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-16 Thread Aaron Bannert
I have some use cases that just want a thread. Since no child-pool is required in this case, it becomes unnecessary overhead (that is currently broken, as the child-pool is only cleaned in apr_thread_exit() but that whole thing is screwey). Again, that is incorrect. The THREAD-pool is

RE: [PATCH] Add intraprocess mutex to threaded MPM (WAS Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded)

2001-07-16 Thread GUMMALAM,MOHAN (HP-Cupertino,ex2)
PROTECTED]] Sent: Friday, July 13, 2001 11:49 PM To: [EMAIL PROTECTED] Subject: Re: [PATCH] Problems with MPM threaded On Sat, Jul 14, 2001 at 12:42:29AM -0400, GUMMALAM,MOHAN (HP-Cupertino,ex2) wrote: snip Have you taken a look at the patch I posted that merges the POD code

Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-15 Thread Luke Kenneth Casson Leighton
On Sat, Jul 14, 2001 at 12:40:06PM -0700, Aaron Bannert wrote: APR threads, when created, would now take an additional parameter that is the mechanism (an sms implementation) by which it should create child pools. As it is now, the pool that is passed in to apr_thread_create() serves as the

Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-15 Thread Aaron Bannert
On Sun, Jul 15, 2001 at 06:49:51PM +0200, Luke Kenneth Casson Leighton wrote: On Sat, Jul 14, 2001 at 12:40:06PM -0700, Aaron Bannert wrote: APR threads, when created, would now take an additional parameter that is the mechanism (an sms implementation) by which it should create child

RE: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-15 Thread Sander Striker
Fair enough. It's just that in order to opt-out of the child-pool creating process in apr_thread_create, we're going to have to add a parameter Why are we so desperate in opting out the child-pool creation? I don't really have problems with a child pool for each thread. Actually, it will make

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-15 Thread Aaron Bannert
On Sun, Jul 15, 2001 at 07:16:35PM +0200, Sander Striker wrote: Fair enough. It's just that in order to opt-out of the child-pool creating process in apr_thread_create, we're going to have to add a parameter Why are we so desperate in opting out the child-pool creation? I don't really

RE: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-15 Thread Sander Striker
Why are we so desperate in opting out the child-pool creation? I don't really have problems with a child pool for each thread. Actually, it will make the dynamic locking a lot easier to implement if it stays. I have some use cases that just want a thread. Since no child-pool is

Re: [PATCH] Problems with MPM threaded

2001-07-14 Thread Justin Erenkrantz
On Sat, Jul 14, 2001 at 12:42:29AM -0400, GUMMALAM,MOHAN (HP-Cupertino,ex2) wrote: I propose the following patch [PATCH A]: It will partially fix the unwanted child deaths problem (symptoms mentioned in the mails included below). It fixes the problem by making sure that

Re: [PATCH] Problems with MPM threaded

2001-07-14 Thread Aaron Bannert
On Sat, Jul 14, 2001 at 12:42:29AM -0400, GUMMALAM,MOHAN (HP-Cupertino,ex2) wrote: [snip] SOLUTION 1: I plan to temporarily implement a new apr_lock_acquire_timeout() function, which would cause the threads waiting on the mutex to give-up after sometime. The piece of code would look

Re: [PATCH] Problems with MPM threaded

2001-07-14 Thread rbb
SOLUTION 2: One could use a slightly more _involved_ approach, where the dying thread could send a signal to its sibling threads, each of which will then handle that signal with a graceful exit. How? A thread doesn't have a process id associated with it. And, I'm curious to whether

Re: [PATCH] Problems with MPM threaded

2001-07-14 Thread Justin Erenkrantz
On Sat, Jul 14, 2001 at 09:19:17AM -0700, [EMAIL PROTECTED] wrote: No! The threaded MPM does NOT and was not intended to implement a thread-only server. It was designed to implement a hybrid thread/process server. Because we expect both threads and processes, the rest of this message is

Re: [PATCH] Problems with MPM threaded

2001-07-14 Thread rbb
On Sat, 14 Jul 2001, Justin Erenkrantz wrote: On Sat, Jul 14, 2001 at 09:19:17AM -0700, [EMAIL PROTECTED] wrote: No! The threaded MPM does NOT and was not intended to implement a thread-only server. It was designed to implement a hybrid thread/process server. Because we expect both

Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Sander Striker
By having the possibility of having other children processes, you now need a mechanism to kill all threads in the same process efficiently. You'd need to kick them out of the accept mutex, but I'm not seeing how that's going to happen quickly. -- justin You need to be able to kill all

Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Justin Erenkrantz
On Sat, Jul 14, 2001 at 09:13:08PM +0200, Sander Striker wrote: The way I see it, each process has a single pool instance as the parent for all the threads. Resetting or destroying that pool should effectively kill all threads. What am I missing? As I see it, the problem is: [ Platforms with

RE: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Sander Striker
The way I see it, each process has a single pool instance as the parent for all the threads. Resetting or destroying that pool should effectively kill all threads. What am I missing? As I see it, the problem is: [ Platforms with SAFE_ACCEPT == APR_SUCCESS rather than the lock don't

Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Aaron Bannert
On Sat, Jul 14, 2001 at 12:27:05PM -0700, Justin Erenkrantz wrote: And, you can't kick the thread out of the mutex acquire (pthread_cancel or similar strategies don't cancel a mutex operation), so you are screwed. And, destroying its parent pool does *NOT* destroy the thread. Look at the

Re: Terminating threads in a process, WAS: RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Justin Erenkrantz
On Sat, Jul 14, 2001 at 09:43:53PM +0200, Sander Striker wrote: Err, doesn't destruction of the mutex wake everyone up? Oh, wait, does every process share the same mutex? Yup. accept_mutex is CROSS_PROCESS. See? That's the rub. You can't destroy it. Otherwise, you'd screw the other child

Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Justin Erenkrantz
On Sat, Jul 14, 2001 at 12:49:51PM -0700, Aaron Bannert wrote: Doesn't pthread_mutex_acquire sit in sem_wait() or sigwait()? That'll let it be cancel()ed. Nope. As I posted earlier, man cancellation on Solaris 8 says: A mutex is explicitly not a cancellation point and should be

Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Aaron Bannert
Async cancellation of threads is VERY bad ju-ju. We don't do it because it causes most, if not all, thread libraries to leak. The cleanups are called because the child pool is destroyed when all the threads die. Right, but we're about to kill the processes anyway, so who cares if it leaks

Standards compliance in Apache code WAS Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Justin Erenkrantz
On Sat, Jul 14, 2001 at 01:19:43PM -0700, Aaron Bannert wrote: Async cancellation of threads is VERY bad ju-ju. We don't do it because it causes most, if not all, thread libraries to leak. The cleanups are called because the child pool is destroyed when all the threads die. Right, but

Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Aaron Bannert
On Sat, Jul 14, 2001 at 01:18:04PM -0700, Justin Erenkrantz wrote: On Sat, Jul 14, 2001 at 12:49:51PM -0700, Aaron Bannert wrote: Doesn't pthread_mutex_acquire sit in sem_wait() or sigwait()? That'll let it be cancel()ed. Nope. As I posted earlier, man cancellation on Solaris 8 says:

Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Justin Erenkrantz
On Sat, Jul 14, 2001 at 01:29:35PM -0700, [EMAIL PROTECTED] wrote: What you are missing is the history. All of the problems that we are trying to solve were solved already in the original code. These problem are solved most easily by using two mutexes, one for keeping only one process in

Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Aaron Bannert
On Sat, Jul 14, 2001 at 01:29:35PM -0700, [EMAIL PROTECTED] wrote: This is why the original code, in apache-apr, written by Manoj back at IBM used two mutexes. The first was cross-process, the second was cross-threads. It allowed us to handle this much cleaner. I didn't realize this had

[PATCH] Add intraprocess mutex to threaded MPM WAS Re: Terminiting threads in a process RE: [PATCH] Problems with MPM threaded

2001-07-14 Thread Justin Erenkrantz
Ah. Yes, that makes more sense. But, that's not what's there now. Shall I submit a patch to threaded MPM to do this? -- justin Please. This also includes my POD patch. I can separate it out if you don't want the POD code merged yet. -- justin Index: threaded.c

Re: [PATCH] Problems with MPM threaded

2001-07-14 Thread Roy T. Fielding
The correct fix, as I see it, is to kill off the interprocess accept lock by removing the possibility of having other processes in a *threaded* MPM. -- justin That architecture was explored in detail by Netscape. It isn't reliable and slows your web server to a crawl whenever dynamic