ANNOUNCE: DBIx::Timeout v1.00
am 17.09.2006 06:36:51 von SamChanges
- First release!
Description
This module provides a safe method of timing out DBI requests. An
unsafe method is described in the DBI docs:
http://search.cpan.org/~timb/DBI/DBI.pm#Signal_Handling_and_ Canceling_Operations
The problem with using POSIX sigaction() (the method described
above) is that it relies on unsafe signals to work. Unsafe
signals are well known to cause instability. To understand why,
imagine the DB client code is in the middle of updating some
global state when the signal arrives. That global state could be
left in an inconsitent state, just waiting for the next time it is
needed to cause problems. Since this will likely occur far from
the cause, and only ocur rarely, it can be a very difficult
problem to track down.
Instead, this module:
- Forks a child process which sleeps for $timeout seconds.
- Runs your long-running query in the parent process.
- If the parent process finishes first it kills the child and
returns.
- If the child process wakes up it kills the parent's DB thread
and exits with a code so the parent knows it was timed out.
Download
You can get DBIx::Timeout using the CPAN shell or at:
http://search.cpan.org/~samtregar/DBIx-Timeout/