Browse files

signals sent to parent fastCGI process are now propagated to all rend…

…er children
  • Loading branch information...
1 parent 0fa5997 commit b7ab93a19060e39d456431d23bda410d574ac9fb @lstein lstein committed Feb 8, 2012
Showing with 11 additions and 7 deletions.
  1. +5 −1 cgi-bin/gbrowse
  2. +3 −3 lib/Bio/Graphics/Browser2/Render.pm
  3. +3 −3 lib/Bio/Graphics/Browser2/RenderPanels.pm
View
6 cgi-bin/gbrowse
@@ -29,14 +29,18 @@ if ($fcgi) {
%ENV = (%sys_env, %ENV);
my $globals = Bio::Graphics::Browser2->open_globals;
CGI->initialize_globals();
- my $render =Bio::Graphics::Browser2::Render::HTML->new($globals);
+ my $render = Bio::Graphics::Browser2::Render::HTML->new($globals);
eval {
local $SIG{PIPE} = sub {die "pipe"};
$render->run();
};
warn $@ if $@;
$render->destroy;
}
+
+ my $pgrp = getpgrp();
+ kill TERM => -$pgrp;
+
} else {
$SIG{TERM} = sub { warn "gbrowse going down..."; CORE::exit 0 };
my $globals = Bio::Graphics::Browser2->open_globals;
View
6 lib/Bio/Graphics/Browser2/Render.pm
@@ -89,8 +89,9 @@ sub new {
sub set_signal_handlers {
my $self = shift;
$SIG{CHLD} = sub {
- my $kid;
- do { $kid = waitpid(-1, WNOHANG) } while $kid > 0;
+ while ((my $kid = waitpid(-1,WNOHANG))>0) {
+ 1;
+ }
};
}
@@ -4015,7 +4016,6 @@ sub fork {
return $child;
}
-
sub prepare_modperl_for_fork {
my $self = shift;
my $r = modperl_request() or return;
View
6 lib/Bio/Graphics/Browser2/RenderPanels.pm
@@ -168,7 +168,6 @@ sub request_panels {
open STDIN, "</dev/null" or die "Couldn't reopen stdin";
open STDOUT,">/dev/null" or die "Couldn't reopen stdout";
- POSIX::setsid() or die "Couldn't start new session";
if ( $do_local && $do_remote ) {
if ( $render->fork() ) {
@@ -373,7 +372,7 @@ sub render_tracks {
my $requests = shift;
my $args = shift;
my %result;
-
+
for my $label ( keys %$requests ) {
my $data = $requests->{$label};
my $gd = eval{$data->gd} or next;
@@ -1449,6 +1448,7 @@ sub run_local_requests {
delete $children{$pid} if $children{$pid};
}
};
+ local $SIG{TERM} = sub { warn "[$$] GBrowse render process terminated"; exit 0; };
my $max_processes = $self->source->global_setting('max_render_processes')
|| MAX_PROCESSES;
@@ -1519,7 +1519,7 @@ sub run_local_requests {
my $featurefile_select = $args->{featurefile_select}
|| $self->feature_file_select($section);
- if ( ref $file and $panel ) {
+ if ( ref $file and $panel ) {
$self->add_feature_file(
file => $file,
panel => $panel,

0 comments on commit b7ab93a

Please sign in to comment.