ANNOUNCE: DBIx::Timeout v1.01

ANNOUNCE: DBIx::Timeout v1.01

am 20.09.2006 02:04:17 von Sam

Changes

- Resolved mysterious warning - PrintError silences it.

- Now using POSIX::_exit() to avoid problems where the exit-code
from calls to exit() doesn't make it to the parent.

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/