diff options
author | ivan <ivan> | 2011-04-08 01:31:48 +0000 |
---|---|---|
committer | ivan <ivan> | 2011-04-08 01:31:48 +0000 |
commit | bd308615d789c624c787d8139655bcf5fd6358c7 (patch) | |
tree | f464422ae8fcb5c9109e65f94bcb66602d29af79 | |
parent | 28ba04005c9ac95f4539257a95d23eeef9705206 (diff) |
continue attempting to handle mysql hanging on queries, RT#10574
-rw-r--r-- | FS/bin/freeside-torrus-srvderive | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/FS/bin/freeside-torrus-srvderive b/FS/bin/freeside-torrus-srvderive index 4ee367bd4..0bf2db82d 100644 --- a/FS/bin/freeside-torrus-srvderive +++ b/FS/bin/freeside-torrus-srvderive @@ -96,28 +96,22 @@ MAIN: while (1) { warn "executing search\n" if $DEBUG; + my $alarm = 0; eval { - 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'; - }, - { mask=>['ALRM'] , safe=>1 } - ); + my $h = set_sig_handler( 'ALRM', sub { $alarm = 1; } ); alarm(5*60); # 15*60); $sth->execute($serviceid, $serviceid) or die $sth->errstr; alarm(0); }; alarm(0); - if ( $@ =~ /^_timeout/ ) { + die $@ if $@; + + if ( $alarm ) { warn "search timed out; reconnecting and restarting\n"; + dbh->clone()->do("KILL QUERY ". dbh->{"mysql_thread_id"}) + if driver_name eq 'mysql'; adminsuidsetup($user); next MAIN; - } elsif ( $@ ) { - die $@; } warn "search executed; checking results\n" if $DEBUG; |