Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 5 commits
  • 11 files changed
  • 0 commit comments
  • 1 contributor
View
6 cgi-bin/gbrowse_img
@@ -95,6 +95,11 @@ sub new {
sub run {
my $self = shift;
+
+ # work around PSGI signal munging
+ local *SIG = *CORE::SIG;
+ local $SIG{CHLD} = sub {while ((my $kid = waitpid(-1,POSIX::WNOHANG))>0) {1}};
+
my $render = $self->render;
$render->set_details_multiplier(1);
@@ -136,6 +141,7 @@ sub run {
}
$self->render_image();
+ $self->session->unlock();
return;
}
View
4 conf/GBrowse.conf
@@ -168,10 +168,9 @@ user_accounts_openid = 1
# Path to the database -- you will need to create this database and grant all
# privileges on it to the indicated user.
-user_account_db = DBI:SQLite:$DATABASES/users.sqlite
# For SQLite
-# user_account_db = DBI:SQLite:$DATABASES/users.sqlite
+user_account_db = DBI:SQLite:$DATABASES/users.sqlite
# For MySQL
# user_account_db = DBI:mysql:gbrowse_login;user=gbrowse;password=gbrowse
@@ -205,7 +204,6 @@ email_address = noreply@gmod.org
admin_account = admin
admin_dbs = $DATABASES/admin_uploads
-
######## DEFAULT DATASOURCE #########
default source = yeast
View
6 install_util/GBrowseInstall.pm
@@ -41,6 +41,7 @@ my %OK_PROPS = @OK_PROPS;
sub ACTION_demo {
my $self = shift;
$self->depends_on('config_data');
+ $self->depends_on('build');
my $dir = tempdir(
'GBrowse_demo_XXXX',
@@ -862,8 +863,9 @@ HostnameLookups Off
LoadModule log_config_module $modules/mod_log_config.so
</IfModule>
- <IfModule !cgi_module>
- LoadModule cgi_module $modules/mod_cgi.so
+ <IfModule !cgid_module>
+ LoadModule cgid_module $modules/mod_cgid.so
+ ScriptSock "$dir/logs/cgisock"
</IfModule>
<IfModule !authz_host_module>
View
2 lib/Bio/Graphics/Browser2.pm
@@ -140,6 +140,8 @@ sub gbrowse_base {
my $url = CGI::url();
my $source = $self->get_source_from_cgi;
$source = CGI::escape($source);
+ # work around PSGI inconsistencies in CGI emulation
+ $url =~ s!/$source/?!!;
$url =~ s!/[^/]*$!!;
return ($url,$source);
}
View
3 lib/Bio/Graphics/Browser2/Action.pm
@@ -88,7 +88,8 @@ sub handle_legacy_calls {
# redirect to the imagelink
if (my $format = $q->param('make_image')) {
- return (302,undef,$render->image_link($render->state,$format));
+ my $link = $render->image_link($render->state,$format);
+ return (302,undef,$link);
}
if ($q->param('clear_dsn') || $q->param('reset_dsn')) {
View
1 lib/Bio/Graphics/Browser2/AuthorizedFeatureFile.pm
@@ -31,6 +31,7 @@ GBrowse internal module.
sub setting {
my $self = shift;
my ($label,$option,@rest) = @_ >= 2 ? @_ : ('general',@_);
+ $label ||= 'general';
$label = 'general' if lc $label eq 'general'; # buglet
$self->SUPER::setting($label,$option,@rest);
}
View
6 lib/Bio/Graphics/Browser2/DataSource.pm
@@ -1358,6 +1358,12 @@ sub use_inline_imagemap {
my $inline = $self->semantic_fallback_setting($label=>'inline imagemaps',$length)
||$self->semantic_fallback_setting($label=>'inline imagemap', $length);
return $inline if defined $inline;
+ return 1 if not (Bio::Graphics::Browser2::Render->fcgi_request()
+ ||
+ $ENV{MOD_PERL_API_VERSION}
+ ||
+ $ENV{'psgi.version'}
+ );
my $db = $self->open_database($label,$length) or return 1;
return !$db->can('get_feature_by_id');
}
View
6 lib/Bio/Graphics/Browser2/RegionSearch.pm
@@ -348,7 +348,11 @@ sub search_features_locally {
# My oh my. block eval is not working as expected here. Sometimes the die is not caught.
my $status = eval <<'END';
- local $SIG{ALRM} = sub { warn "alarm clock" ; die "The search timed out; try a more specific search\n"; die; };
+ # we set %CORE::GLOBAL::SIG here to work around PSGI signal munging
+ local $CORE::GLOBAL::SIG{ALRM} = sub { warn "alarm clock" ;
+ die "The search timed out; try a more specific search\n";
+ die;
+ };
alarm($timeout);
$result = $self->_search_features_locally(@_);
1;
View
35 lib/Bio/Graphics/Browser2/Render.pm
@@ -40,14 +40,13 @@ use constant EMPTY_IMAGE_HEIGHT => 12;
use constant MAX_SEGMENT => 1_000_000;
use constant TOO_MANY_SEGMENTS => 5_000;
use constant OVERVIEW_RATIO => 1.0;
-use constant GROUP_SEPARATOR => "\x1d";
-use constant LABEL_SEPARATOR => "\x1e";
+use constant GROUP_SEPARATOR => "\x80";
+use constant LABEL_SEPARATOR => "\x81";
my %PLUGINS; # cache initialized plugins
my $FCGI_REQUEST; # stash fastCGI request handle
my $STATE; # stash state for use by callbacks
-
# new() can be called with two arguments: ($data_source,$session)
# or with one argument: ($globals)
# in the latter case, it will invoke this code:
@@ -82,19 +81,9 @@ sub new {
$self->session($session);
$self->state($session->page_settings);
$self->set_language();
- $self->set_signal_handlers();
$self;
}
-sub set_signal_handlers {
- my $self = shift;
- $SIG{CHLD} = sub {
- while ((my $kid = waitpid(-1,WNOHANG))>0) {
- 1;
- }
- };
-}
-
sub data_source {
my $self = shift;
my $d = $self->{data_source};
@@ -237,13 +226,20 @@ sub run {
my $debug = $self->debug || TRACE;
+ # work around PSGI signal munging
+ local *SIG = *CORE::SIG;
+ local $SIG{CHLD} = sub {
+ while ((my $kid = waitpid(-1,WNOHANG))>0) {
+ 1;
+ }
+ };
+
warn "[$$] RUN(): ",
request_method(),': ',
url(-path=>1),' ',
query_string() if $debug || TRACE_RUN;
warn "[$$] session id = ",$self->session->id if $debug;
-
-# $self->set_source() && return;
+ $self->set_source && return;
my $session = $self->session;
my $source = $self->data_source;
@@ -263,6 +259,7 @@ sub run {
# authentication required, but not a login session, so initiate authentication request
$self->force_authentication;
$session->flush;
+ $session->unlock;
return;
}
}
@@ -301,7 +298,8 @@ sub run {
warn "[$$] session flush" if $debug;
$self->session->flush;
-
+ $session->unlock;
+
delete $self->{usertracks};
warn "[$$] synchronous exit" if $debug;
}
@@ -323,11 +321,14 @@ sub set_source {
my $source = $self->session->source;
- if (CGI::unescape(CGI::path_info()) ne CGI::unescape("/$source/")) {
+ my $request = CGI::unescape(CGI::request_uri());
+ my $source_str = CGI::unescape("/$source/");
+ if ($request !~ /$source_str($|\?)/) {
my $args = CGI::query_string();
my $url = CGI::url(-absolute=>1,-path_info=>0);
$url =~ s!(gbrowse[^/]*)(?\!.*gbrowse)/.+$!$1!; # fix CGI/Apache bug
$url .= "/$source/";
+ $url =~ s!//!/!g;
$url .= "?$args" if $args && $args !~ /^source=/;
print CGI::redirect($url);
return 1;
View
3 lib/Bio/Graphics/Browser2/RenderPanels.pm
@@ -1499,7 +1499,8 @@ sub run_local_requests {
my $oldaction;
my $time = time();
eval {
- local $SIG{ALRM} = sub { warn "alarm clock"; die "timeout" };
+ # we set %CORE::GLOBAL::SIG here to work around PSGI signal munging
+ local $CORE::GLOBAL::SIG{ALRM} = sub { warn "alarm clock"; die "timeout" };
alarm($timeout);
$requests->{$label}->lock();
View
13 lib/Bio/Graphics/Browser2/Session.pm
@@ -68,7 +68,7 @@ sub new {
if (DEBUG_LOCK) {
my $state = $self->page_settings;
my @tracks = sort grep {$state->{features}{$_}{visible}} keys %{$state->{features}};
- warn '[',$self->time,'] ',"[$$] READING @tracks\n";
+ warn '[',$self->time,'] ',"[$$] READING @tracks";
}
## DEBUG ENDS
@@ -127,7 +127,9 @@ sub lock {
warn '[',$self->time,'] ',"[$$] waiting on $type session lock...\n" if DEBUG_LOCK;
eval {
- local $SIG{ALRM} = sub {die "timeout\n"};
+ # we set %CORE::GLOBAL::SIG here to work around PSGI signal munging
+ local $CORE::GLOBAL::SIG{ALRM} = sub {die "timeout\n";};
+
# timeout lock to avoid some process from keeping process open
# you may see some lock timeouts if a process is taking too long
# to release its session.
@@ -150,7 +152,7 @@ sub lock {
my $elapsed = sprintf("%5.3fs",$self->time()-$start_time);
if ($@) {
die $@ unless $@ eq "timeout\n";
- warn ("[$$] session lock timed out on request after $elapsed\n",
+ warn ("[$$] session lock timed out on request after $elapsed. REQUEST=",
CGI::request_method(),': ',
CGI::url(-path=>1),' ',
CGI::query_string());
@@ -172,7 +174,7 @@ sub lock_flock {
mkpath($lockdir) unless -e $lockdir;
my $lockpath = File::Spec->catfile($lockdir,$lockfile);
- my $o_mode = $mode eq 'exclusive' ? '>'
+ my $o_mode = $type eq 'exclusive' ? '>'
:-e $lockpath ? "<"
: "+>";
@@ -276,12 +278,11 @@ sub flush {
if (DEBUG_LOCK) {
my $state = $self->page_settings;
my @tracks = sort grep {$state->{features}{$_}{visible}} keys %{$state->{features}};
- warn '[',$self->time,'] ',"[$$] WRITING @tracks\n";
+ warn '[',$self->time,'] ',"[$$] WRITING @tracks";
}
## DEBUG ENDS
$self->{session}->flush if $self->{session};
-# $self->unlock;
warn "[$$] SESSION FLUSH ERROR: ",$self->{session}->errstr
if $self->{session}->errstr;
}

No commit comments for this range

Something went wrong with that request. Please try again.