Skip to content

Commit

Permalink
added fixes for FastCGI stability
Browse files Browse the repository at this point in the history
  • Loading branch information
lstein committed Jun 8, 2009
1 parent c9d8507 commit 020f4dd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
10 changes: 8 additions & 2 deletions cgi-bin/gb2/gbrowse
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@ use Bio::Graphics::Browser::Render::HTML;

umask 022;

my $fcgi = Bio::Graphics::Browser::Render->fcgi_request;
my $fcgi = Bio::Graphics::Browser::Render->fcgi_request;

if ($fcgi) {

while ($fcgi->Accept >= 0) {
my $FCGI_DONE = 0;
$SIG{TERM} = sub {
print STDERR "[$$] FastCGI termination signalled. Will exit.\n";
$FCGI_DONE = 1;
};

while (!$FCGI_DONE && ($fcgi->Accept >= 0)) {
my $globals = Bio::Graphics::Browser->open_globals;
CGI->initialize_globals();
Bio::Graphics::Browser::Render::HTML->new($globals)->run();
Expand Down
10 changes: 8 additions & 2 deletions cgi-bin/gb2/gbrowse_details
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Bio::Graphics::Browser::RegionSearch;
use Bio::Graphics::Browser::Markup;
use Bio::Graphics::Glyph::generic;

our $VERSION = '$Id: gbrowse_details,v 1.13 2009-05-14 21:46:09 lstein Exp $';
our $VERSION = '$Id: gbrowse_details,v 1.14 2009-06-08 19:24:04 lstein Exp $';
our ($INDEX,%COLORS,%URLS,%formatterCache);


Expand All @@ -24,7 +24,13 @@ my $fcgi = Bio::Graphics::Browser::Render->fcgi_request;

if ($fcgi) {

while ($fcgi->Accept >= 0) {
my $FCGI_DONE = 0;
$SIG{TERM} = sub {
print STDERR "[$$] FastCGI termination signalled. Will exit.\n";
$FCGI_DONE = 1;
};

while (!$FCGI_DONE && ($fcgi->Accept >= 0)) {
CGI->initialize_globals();
DetailRenderer->new($conf)->run();
$fcgi->Finish();
Expand Down
10 changes: 8 additions & 2 deletions cgi-bin/gb2/gbrowse_img
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w

# $Id: gbrowse_img,v 1.10 2009-05-22 14:33:38 lstein Exp $
# $Id: gbrowse_img,v 1.11 2009-06-08 19:24:04 lstein Exp $

use strict;

Expand Down Expand Up @@ -28,7 +28,13 @@ umask 022;
my $fcgi = Bio::Graphics::Browser::Render->fcgi_request;
if ($fcgi) {

while ($fcgi->Accept >= 0) {
my $FCGI_DONE = 0;
$SIG{TERM} = sub {
print STDERR "[$$] FastCGI termination signalled. Will exit.\n";
$FCGI_DONE = 1;
};

while (!$FCGI_DONE && ($fcgi->Accept >= 0)) {
my $globals = Bio::Graphics::Browser->open_globals;
CGI->initialize_globals();
GBrowse_img->new($globals)->run();
Expand Down
4 changes: 3 additions & 1 deletion lib/Bio/Graphics/Browser/RegionSearch.pm
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ sub init_databases {
next if $state->{dbid} && $state->{dbid} ne $dbid;
my $search_options = $source->setting($dbid => 'search options') || '';

next if $search_options eq 'none'; # ignore this in the search
# this can't be right - we need to do id searches
# next if $search_options eq 'none';

$dbs{$dbid}{options} ||= $search_options;
$dbs{$dbid}{remotes}{$remote}++ if $remote;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Bio/Graphics/Browser/RenderPanels.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1926,8 +1926,8 @@ sub make_link {
my $end = CGI::escape($feature->end);
my $src = CGI::escape(eval{$feature->source} || '');
my $url = CGI->request_uri || '../..';
my $id = eval {$feature->primary_id};
my $dbid = eval {$feature->gbrowse_dbid};
my $dbid = eval {CGI::escape($feature->gbrowse_dbid)};
my $id = eval {CGI::escape($feature->primary_id)};
$url =~ s!/gbrowse.*!!;
$url .= "/gbrowse_details/$ds_name?ref=$ref;start=$start;end=$end";
$url .= ";name=$name" if defined $name;
Expand Down

0 comments on commit 020f4dd

Please sign in to comment.