I'm looking for a server-wide setting for timeout with mod_perl scripts under Apache 2.2, similar to max_execution_time in php.

Timeout can be done with $SIG{ALRM} but it requires modification to every perl script and is incompatible with with sleep().

Apache has a TimeOut configuration directive, however it has no effect on mod_perl. With TimeOut 5, timeout does not occur for a test script that sleeps for 10 seconds before printing anything.

The Apache2::ServerRec module has a timeout() method, but it simply gets/sets the value of Apache's TimeOut variable, and therefore has no effect on mod_perl as well.

How can it be done? If it cannot be done, what is the best practice for timeout in mod_perl?

link|improve this question

79% accept rate
feedback

1 Answer

up vote 1 down vote accepted

mod_perl does not, unfortunately, have a way of doing this. What does have a way of implementing timeouts its mod_fcgid (via the FcgidBusyTimeout directive). This shouldn't require any significant modifications to your script, unless its making use of mod_perl specific functionality.

A good comparison between mod_perl and mod_fcgid is available on StackOverflow, but if implementing universal timeouts is your requirement, mod_fcgid sounds like its the only way to go.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.