Permalink
Browse files

fix most sigPIPE errors in mysql locker

  • Loading branch information...
Lincoln Stein
Lincoln Stein committed Nov 29, 2011
1 parent adf26c7 commit 74a879a0b73d960a85898d1d55e6c3c9f6ed9d36
View
@@ -11,18 +11,8 @@ use Bio::Graphics::Browser2::Render::HTML;
umask 022;
my $fcgi = Bio::Graphics::Browser2::Render->fcgi_request;
-my $modperl = $ENV{MOD_PERL};
my $init;
-if ($modperl && !$init++) {
- $SIG{USR1} = $SIG{PIPE} = $SIG{TERM} = sub {
- my $sig = shift;
- my $time = localtime;
- print STDERR "[$time] [notice] GBrowse modPerl process caught sig$sig. Exiting... (pid $$)\n";
- CORE::exit 0
- };
-}
-
if ($fcgi) {
my $FCGI_DONE = 0;
$SIG{USR1} = $SIG{PIPE} = $SIG{TERM} = sub {
@@ -3971,7 +3971,7 @@ sub fcgi_request {
sub fork {
my $self = shift;
-
+
$self->prepare_modperl_for_fork();
$self->prepare_fcgi_for_fork('starting');
@@ -1438,7 +1438,7 @@ sub run_local_requests {
local $SIG{CHLD} = sub {
while ((my $pid = waitpid(-1, WNOHANG)) > 0) {
- print STDERR "[$$] reaped render child $pid\n" if DEBUG;
+ print STDERR "[$$] reaped render child $pid" if DEBUG;
$reaped{$pid}++;
delete $children{$pid} if $children{$pid};
}
@@ -199,6 +199,7 @@ sub lock_nfs {
sub lock_mysql {
my $self = shift;
my ($type,$id) = @_;
+ $SIG{PIPE} = 'IGNORE';
return if $type eq 'shared';
my $lock_name = $self->mysql_lock_name($id);
(my $dsn = $self->{locktype}) =~ s/^mysql://;
@@ -222,7 +223,7 @@ sub unlock {
warn '[',$self->time,'] ',"[$$] session unlock" if DEBUG_LOCK;
if ($lock->isa('DBI::db')) {
my $lock_name = $self->mysql_lock_name($self->id);
- $lock->do("SELECT RELEASE_LOCK('$lock_name')");
+ my $result = $lock->do("SELECT RELEASE_LOCK('$lock_name')");
}
$self->lockobj(undef);
warn "[$$] lock released after ",sprintf("%2.1f",$self->time() - $self->locktime)," s" if DEBUG;

0 comments on commit 74a879a

Please sign in to comment.