You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2003/11/26 04:45:34 UTC
cvs commit: httpd-2.0/server mpm_common.c
trawick 2003/11/25 19:45:34
Modified: . CHANGES configure.in
include ap_mpm.h
server mpm_common.c
Log:
Add fatal exception hook for use by debug modules. The hook is only
available if the --enable-exception-hook configure parm is used.
Sample users at http://httpd.apache.org/~trawick/exception_hook.html
Revision Changes Path
1.1329 +4 -0 httpd-2.0/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.1328
retrieving revision 1.1329
diff -u -r1.1328 -r1.1329
--- CHANGES 25 Nov 2003 17:53:25 -0000 1.1328
+++ CHANGES 26 Nov 2003 03:45:34 -0000 1.1329
@@ -2,6 +2,10 @@
[Remove entries to the current 2.0 section below, when backported]
+ *) Add fatal exception hook for use by debug modules. The hook is only
+ available if the --enable-exception-hook configure parm is used.
+ [Jeff Trawick]
+
*) mod_ssl/mod_status: Re-enable support for output of SSL session
cache information in server-status page. [Joe Orton]
1.256 +6 -0 httpd-2.0/configure.in
Index: configure.in
===================================================================
RCS file: /home/cvs/httpd-2.0/configure.in,v
retrieving revision 1.255
retrieving revision 1.256
diff -u -r1.255 -r1.256
--- configure.in 28 Sep 2003 16:27:23 -0000 1.255
+++ configure.in 26 Nov 2003 03:45:34 -0000 1.256
@@ -365,6 +365,12 @@
[Allow IPv4 connections on IPv6 listening sockets])
fi
+AC_ARG_ENABLE(exception-hook,APACHE_HELP_STRING(--enable-exception-hook,Enable fatal exception hook),
+[
+ AC_DEFINE(AP_ENABLE_EXCEPTION_HOOK, 1,
+ [Allow modules to run hook after a fatal exception])
+])dnl
+
AC_ARG_ENABLE(maintainer-mode,APACHE_HELP_STRING(--enable-maintainer-mode,Turn on debugging and compile time warnings),
[
APR_ADDTO(CPPFLAGS, -DAP_DEBUG)
1.35 +9 -0 httpd-2.0/include/ap_mpm.h
Index: ap_mpm.h
===================================================================
RCS file: /home/cvs/httpd-2.0/include/ap_mpm.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- ap_mpm.h 3 Feb 2003 17:52:53 -0000 1.34
+++ ap_mpm.h 26 Nov 2003 03:45:34 -0000 1.35
@@ -197,4 +197,13 @@
#define AP_MONCONTROL(x)
#endif
+#if AP_ENABLE_EXCEPTION_HOOK
+typedef struct ap_exception_info_t {
+ int sig;
+ pid_t pid;
+} ap_exception_info_t;
+
+AP_DECLARE_HOOK(int,fatal_exception,(ap_exception_info_t *ei))
+#endif /*AP_ENABLE_EXCEPTION_HOOK*/
+
#endif
1.110 +24 -0 httpd-2.0/server/mpm_common.c
Index: mpm_common.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/mpm_common.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -r1.109 -r1.110
--- mpm_common.c 22 Nov 2003 20:43:25 -0000 1.109
+++ mpm_common.c 26 Nov 2003 03:45:34 -0000 1.110
@@ -919,11 +919,35 @@
static pid_t parent_pid, my_pid;
apr_pool_t *pconf;
+#if AP_ENABLE_EXCEPTION_HOOK
+APR_HOOK_STRUCT(
+ APR_HOOK_LINK(fatal_exception)
+)
+
+AP_IMPLEMENT_HOOK_RUN_ALL(int, fatal_exception,
+ (ap_exception_info_t *ei), (ei), OK, DECLINED)
+
+static void run_fatal_exception_hook(int sig)
+{
+ ap_exception_info_t ei = {0};
+
+ if (geteuid() != 0 &&
+ my_pid != parent_pid) {
+ ei.sig = sig;
+ ei.pid = my_pid;
+ ap_run_fatal_exception(&ei);
+ }
+}
+#endif /* AP_ENABLE_EXCEPTION_HOOK */
+
/* handle all varieties of core dumping signals */
static void sig_coredump(int sig)
{
apr_filepath_set(ap_coredump_dir, pconf);
apr_signal(sig, SIG_DFL);
+#if AP_ENABLE_EXCEPTION_HOOK
+ run_fatal_exception_hook(sig);
+#endif
if (my_pid == parent_pid) {
ap_log_error(APLOG_MARK, APLOG_NOTICE,
0, ap_server_conf,
Re: cvs commit: httpd-2.0/server mpm_common.c
Posted by Jeff Trawick <tr...@attglobal.net>.
André Malo <nd...@perlig.de> writes:
> * trawick@apache.org wrote:
>
> > Add fatal exception hook for use by debug modules. The hook is only
> > available if the --enable-exception-hook configure parm is used.
> >
> > Sample users at http://httpd.apache.org/~trawick/exception_hook.html
>
> > +[
> > + AC_DEFINE(AP_ENABLE_EXCEPTION_HOOK, 1,
> > + [Allow modules to run hook after a fatal exception])
> > +])dnl
> > +
>
> there's a dnl too much.
I'll remove it; I don't know why there is dnl after some other
AC_ARG_ENABLE() invocations. Do you know by any chance?
> Docs note: The "on test systems only" sentence should appear in a big
> warning box (with red letters :-). Perhaps this should be reflected in the
> configure help itself.
That doc, and especially that comment, refers only to those sample
modules. Probably I would remove the "on test systems only" comment
if I get time to review mod_whatkilledus closely. For quite a while
it had some assumptions of non-threaded MPM, and I don't recall how
much testing it had after I removed those assumptions, hence the
comment ;) Meanwhile, forcing a segfault (via a special request
handled by a special module) while the worker MPM is under load yields
no surprises.
--
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org
Re: cvs commit: httpd-2.0/server mpm_common.c
Posted by Jeff Trawick <tr...@attglobal.net>.
André Malo <nd...@perlig.de> writes:
> * trawick@apache.org wrote:
>
> > Add fatal exception hook for use by debug modules. The hook is only
> > available if the --enable-exception-hook configure parm is used.
> >
> > Sample users at http://httpd.apache.org/~trawick/exception_hook.html
>
> > +[
> > + AC_DEFINE(AP_ENABLE_EXCEPTION_HOOK, 1,
> > + [Allow modules to run hook after a fatal exception])
> > +])dnl
> > +
>
> there's a dnl too much.
I'll remove it; I don't know why there is dnl after some other
AC_ARG_ENABLE() invocations. Do you know by any chance?
> Docs note: The "on test systems only" sentence should appear in a big
> warning box (with red letters :-). Perhaps this should be reflected in the
> configure help itself.
That doc, and especially that comment, refers only to those sample
modules. Probably I would remove the "on test systems only" comment
if I get time to review mod_whatkilledus closely. For quite a while
it had some assumptions of non-threaded MPM, and I don't recall how
much testing it had after I removed those assumptions, hence the
comment ;) Meanwhile, forcing a segfault (via a special request
handled by a special module) while the worker MPM is under load yields
no surprises.
--
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...
Re: cvs commit: httpd-2.0/server mpm_common.c
Posted by André Malo <nd...@perlig.de>.
* trawick@apache.org wrote:
> Add fatal exception hook for use by debug modules. The hook is only
> available if the --enable-exception-hook configure parm is used.
>
> Sample users at http://httpd.apache.org/~trawick/exception_hook.html
> +[
> + AC_DEFINE(AP_ENABLE_EXCEPTION_HOOK, 1,
> + [Allow modules to run hook after a fatal exception])
> +])dnl
> +
there's a dnl too much.
Docs note: The "on test systems only" sentence should appear in a big
warning box (with red letters :-). Perhaps this should be reflected in the
configure help itself.
nd
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org
Re: cvs commit: httpd-2.0/server mpm_common.c
Posted by André Malo <nd...@perlig.de>.
* trawick@apache.org wrote:
> Add fatal exception hook for use by debug modules. The hook is only
> available if the --enable-exception-hook configure parm is used.
>
> Sample users at http://httpd.apache.org/~trawick/exception_hook.html
> +[
> + AC_DEFINE(AP_ENABLE_EXCEPTION_HOOK, 1,
> + [Allow modules to run hook after a fatal exception])
> +])dnl
> +
there's a dnl too much.
Docs note: The "on test systems only" sentence should appear in a big
warning box (with red letters :-). Perhaps this should be reflected in the
configure help itself.
nd