From: ivan Date: Fri, 8 Apr 2011 01:27:56 +0000 (+0000) Subject: continue attempting to handle mysql hanging on queries, RT#10574 X-Git-Tag: freeside_2_3_0~440 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=28ba04005c9ac95f4539257a95d23eeef9705206 continue attempting to handle mysql hanging on queries, RT#10574 --- 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 ) {