On Tue, Dec 2, 2008 at 1:56 PM, April Papajohn
<[EMAIL PROTECTED]> wrote:
> I tried setting alarm() around the DBI lines, using the Sys::SigAction
> module, in order to get the script to timeout if MySql isn't
> responsive. This works great if I run it as a plain perl script. But
> it seems that alarm()  doesn't work when it runs as a perl module.

You may be running different versions of perl or DBI in your script.
Signals are tricky when using some DBD drivers.  I suggest looking at
DBIx::Timeout for some information on this.

Realistically, it's not practical to wrap every single DBI call that
might hang if the server went away in the middle.  However, you can
adjust how long MySQL will wait to connect or timeout a dead
connection, and you can use something like Apache::DBI or
DBI->connect_cached which will ping your connection at the beginning
of a request.

- Perrin

Reply via email to