[mod_python] ChildInit handler?

Graham Dumpleton graham.dumpleton at gmail.com
Sun Mar 2 17:55:55 EST 2008


On 03/03/2008, Sean Allen <sean at ardishealth.com> wrote:
>
>  On Mar 2, 2008, at 3:48 PM, Graham Dumpleton wrote:
>
>  > 'mod_python.apache.register_cleanup()'. Note though that no guarantee
>  > that cleanup code will be executed on process shutdown, so you should
>  > not religiously rely on it.
>
> under what circumstances might it not be executed?

When Apache is being stopped or restarted, the main Apache parent
process sends a special message to each child process to trigger the
process to shutdown. If that process doesn't shutdown within a few
seconds the the parent process will send it a SIGKILL and forcibly
kill it.

Thus, if there are delays in running to completion any shutdown code
registered by mod_python or any other Apache module, or possibly long
running requests which are causing things to hang in some way, such
that process shutdown doesn't even commence, then clean shutdown will
not occur and the process will be killed.

Obviously, if a process crashes for whatever reason, no cleanup code
will be run either.

Thus, any startup code you have must be able to cope with an unclean
shutdown of a previous instance.

Graham


More information about the Mod_python mailing list