You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by "Johnson, Chris (MDW)" <ch...@morris.com> on 2007/04/11 16:59:18 UTC

Information Request: Graceful error handling in modules

I am looking for pointers to information/examples on how to have my
module (which is a content generator) gracefully interact with Apache in
error conditions, specifically timeout errors, which I would like my
module to handle.

Nick's book has some information in chapters 5 and 6 but I would like to
find code examples with discussion if possible. I am also working on
searching through the mod_perl sources and the Apache sources.

I would like for my module to receive notification of the timeout upon
which I will abort my current processing (including some notification to
Oracle to abort the currently running query) and either generate an
error page or redirect to an error URL.

My module is written in C, the questions I am looking to answer are:

1. From the standpoint of Apache, is this considered successful request
processing?
2. Is attempting to interrupt the normal timeout handling of Apache bad
practice?
3. What is the correct way to register my timeout handler
(signal/sigaction/ap_set_callback_and_alarm/apr_signal)? The module is
for Apache 2.0 currently and the ap_set_callback_and_alarm function
appears to have been a 1.3 construct.
4. What is the impact of using alarm(#) in my code? It currently appears
to squash any configured timeout for Apache.
5. Once I have finished my timeout processing, is there a standard way
to abort my module (effectively long jump back to the hook function so I
can return control back to Apache)?
6. If it does become necessary, is there a way to ask Apache to dispose
of the current child process after it finishes processing?

I have Nick's Apache Modules book which I am still working through.
Recommendations about questions I should be asking are also welcome.

Thanks,
Chris Johnson