Geoffrey Young wrote:
So may be there is a need to expose it via a proper ap_ api?


Oh, it's definitely better if we can get an ap_ api for this, and I am plannnig on either writing on or at least pigning the folks at httpd-dev about it. I was merely proposing a suggestion that might just fit our needs for now, while we are looking for the best solution.

using a api call vs. signals is not the same thing, so I'm not sure it's a good temporary solution in case we are going to have a proper api call.



In my opinon, the here are the various solutions in order of preference 1. Call an ap_* function 2. Send a SIGTERM 3. Call exit() directly

And most likely, 2 & 3 only make sense for non-threaded MPMs


Right.

OK, so anybody wants to start this thread to httpd-dev before we decide
how to handle it with mod_perl?


I would strongly suggest that we come up with a patch before asking
httpd-dev, as (especially these days) everyone is busy and there are few
free tuits available for the kind of in-depth discussion you are probably
seeking.

I think so too.

I did start looking at this several times, and it seems as though
de-localizing the requests_this_child variable (or whatever it is) would
universally suit our needs.  if that is true, I think our needs would be met
if there were an ap_ api that would allow this value to be set.  the only
issue here is that every MPM would need to support it, but that may not be
that big of a deal since there are other functions that every MPM is
expected to provide (IIRC, that is).  or maybe we could register it as an
optional function or something.

Well, I think touching requests_this_child is not really what we'd want an API for. Since changing that value isn't really what we are after. We are looking for an API to allow clean child termination, so I would suggest more precisely to implement something like ap_mpm_child_terminate() API that could certainly be implemented by setting requests_this_child to zero. But the intent of the api is/should be child termination, allowing various MPMs to do it differently (if at all (thinking win32 mpm)).

anyway, if indeed the requests_this_child approach would work for all MPMs I
would suggest that we (well, somebody :) come up with a patch that ports
prefork, worker, and winnt over to the new API and present it in its
entirety to new-httpd.  this way there would be a concrete patch to
integrate into 2.1 (and thus vote on for 2.0) if discussion is relatively
sparse.

if the requests_this_child approach isn't sufficient, forget this email )

It's not quite sufficitent, as in worker, for instance, you'd need to set requests_this_child < 0 and also make MaxRequestPerChild > 0.

Attached is a possible patch for worker and prefork, the other mpms are left
to do.

--
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
Index: server/mpm_common.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm_common.c,v
retrieving revision 1.123
diff -u -I$Id -r1.123 mpm_common.c
--- server/mpm_common.c	23 Sep 2004 08:59:06 -0000	1.123
+++ server/mpm_common.c	12 Oct 2004 19:12:59 -0000
@@ -1080,3 +1080,10 @@
 }
 
 #endif /* AP_MPM_WANT_FATAL_SIGNAL_HANDLER */
+
+#ifdef AP_MPM_WANT_CHILD_TERMINATE
+AP_DECLARE(void) ap_mpm_child_terminate(void)
+{
+    kill(getpid(), AP_SIG_GRACEFUL);
+}
+#endif /* AP_MPM_WANT_CHILD_TERMINATE */
Index: server/mpm/prefork/mpm.h
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/prefork/mpm.h,v
retrieving revision 1.26
diff -u -I$Id -r1.26 mpm.h
--- server/mpm/prefork/mpm.h	9 Feb 2004 20:40:51 -0000	1.26
+++ server/mpm/prefork/mpm.h	12 Oct 2004 19:12:59 -0000
@@ -37,6 +37,7 @@
 #define AP_MPM_WANT_SIGNAL_SERVER
 #define AP_MPM_WANT_SET_MAX_MEM_FREE
 #define AP_MPM_WANT_FATAL_SIGNAL_HANDLER
+#define AP_MPM_WANT_CHILD_TERMINATE
 #define AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK
 
 #define AP_MPM_USES_POD 1
Index: server/mpm/worker/worker.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/server/mpm/worker/worker.c,v
retrieving revision 1.151
diff -u -I$Id -r1.151 worker.c
--- server/mpm/worker/worker.c	15 Mar 2004 23:08:41 -0000	1.151
+++ server/mpm/worker/worker.c	12 Oct 2004 19:12:59 -0000
@@ -407,6 +407,11 @@
     ap_start_restart(sig == AP_SIG_GRACEFUL);
 }
 
+AP_DECLARE(void) ap_mpm_child_terminate(void)
+{
+   signal_threads(ST_GRACEFUL);
+}
+
 static void set_signals(void)
 {
 #ifndef NO_USE_SIGACTION

Attachment: signature.asc
Description: OpenPGP digital signature



Reply via email to