From 28ba04005c9ac95f4539257a95d23eeef9705206 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 8 Apr 2011 01:27:56 +0000 Subject: [PATCH] continue attempting to handle mysql hanging on queries, RT#10574 --- FS/bin/freeside-torrus-srvderive | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/FS/bin/freeside-torrus-srvderive b/FS/bin/freeside-torrus-srvderive index 95cc76daa..4ee367bd4 100644 --- a/FS/bin/freeside-torrus-srvderive +++ b/FS/bin/freeside-torrus-srvderive @@ -94,11 +94,13 @@ MAIN: while (1) { warn $ssql if $DEBUG > 2; my $sth = dbh->prepare($ssql) or die $DBI::errstr; #better recovery here? - warn "executing search" if $DEBUG; + warn "executing search\n" if $DEBUG; eval { - my $timeout = set_sig_handler( + my $h = set_sig_handler( 'ALRM', sub { + local $SIG{__DIE__}; + warn "search timed out\n"; dbh->clone()->do("KILL QUERY ". dbh->{"mysql_thread_id"}) if driver_name eq 'mysql'; die '_timeout'; @@ -118,7 +120,7 @@ MAIN: while (1) { die $@; } - warn "search executed; checking results" if $DEBUG; + warn "search executed; checking results\n" if $DEBUG; my $prev = 0; while ( my $row = $sth->fetchrow_arrayref ) { -- 2.11.0