[mod_python] execution time limit

Graham Dumpleton grahamd at dscpl.com.au
Fri Jan 12 16:32:38 EST 2007

On 13/01/2007, at 6:38 AM, Mark Harrison wrote:

> Graham Dumpleton wrote:
>> Send this back to the mailing list. I have no idea how PHP does it.
> Something like this might work:
> import signal
> def myalarm(signo, stackframe):
>    ...
> def handler(req):
>     signal.alarm(10) # schedule a sigalarm in 10 seconds
>     signal.signal(signal.SIGALRM, myalarm)
>     do_stuff()
>     signal.alarm(0)  # cancel the alarm

No. Could have potential for problems when using worker MPM or Windows
as you could interrupt system calls being done by handlers executing in
other threads within the same process. It could also interfere with  
the operation
of Apache as well and the manner in which it communicates information  
to the head process.

I would thus probably recommend against this approach.


More information about the Mod_python mailing list