MySQL Forums :: Perl :: SIGALRM blocked by MySQL


Advanced Search

SIGALRM blocked by MySQL
Posted by: Patrick Hollins ()
Date: April 06, 2009 11:21AM

There are many reasons why you have to limit a programs execution time. Perls method of doing this is using the Signal SIGALRM. It works perfectly, unless DBD::MySQL is involved.

MySQL ignores the signal and keeps executing. If I wait a few minutes and KILL the MySQL thread, it prints "Timed out", so I thinking MySQL has it hanging.

Surely someone else has blazed this trail?

Any direction, pointers or links would be greatly appreciated.

Perl 5.8
MySQL 5.0
Mac OS X 10.5
current DBI/DBD

####################################################
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm 5;
$sth = &SQL("SELECT keycol from big_tab_test where keycol < 10");
# sleep 10; # works as expected
alarm 0;
};
if ($@) {
die unless $@ eq "alarm\n";
print "Timed out\n";
exit 0;
}

####################################################



Edited 1 time(s). Last edit at 04/06/2009 11:29AM by Patrick Hollins.

Options: ReplyQuote


Subject Written By Posted
SIGALRM blocked by MySQL Patrick Hollins 04/06/2009 11:21AM
Re: SIGALRM blocked by MySQL Patrick Hollins 04/06/2009 02:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.