[mod_python] ChildInit handler?

Sean Allen sean at ardishealth.com
Sun Mar 2 18:08:18 EST 2008


On Mar 2, 2008, at 5:55 PM, Graham Dumpleton wrote:

> 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.

Right. All that makes sense.

Thanks for your help Graham.



More information about the Mod_python mailing list