Changeset 33315 for gs3-extensions


Ignore:
Timestamp:
2019-07-09T16:54:05+12:00 (5 years ago)
Author:
ak19
Message:
  1. Bugfix to issue discovered on windows: when the GS3 server isn't running, and therefore the solr servlet isn't available either, wget testing the solr servlet URL on Windows returned 'failed: Bad file descriptor' msg, which wasn't one of the cases that the solrserver.pm was monitoring for and responding to. It only looked for 'ERROR ' and 'failed: Connection refused' messages. Added in a check for the bad file descriptor message, but also for any 'failed:' (case insensitive) messages in general, in case in other situations or on other OS we get a slightly different message. 2. When the server isn't running, this is not a fatal error as the solrserver will simply manually start tomcat to process the solr collection. So in such a case we don't want to print something as drastic as WGET_SERVICE got an error, as we hadn't been doing before. Instead on the 'failed:' messages, it prints the message and then adds that this probably means the GS3 server isn't running.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/solr/trunk/src/perllib/solrserver.pm

    r31490 r33315  
    8787    my $xml_output = "";
    8888    my $error_output = undef;
     89    my $is_error = 0;
    8990
    9091    my $in_preamble = ($output_format eq "xml") ? 1 : 0;
     
    9293##    print STDERR "**** wgetcmd = \n $cmd\n";
    9394
    94     if (open(WIN,"$cmd |")) {
     95    if (open(WIN,"$cmd |")) {
    9596
    9697    my $line;
     
    100101        chomp $line;
    101102        $error_output = $line;
     103        $is_error = 1;
    102104        last;
    103105        }
    104         elsif ($line =~ m/failed: Connection refused/) {
     106        elsif ($line =~ m/failed: (Connection refused|Bad file descriptor)/ || $line =~ m/failed:/i) {
     107                    # When the server wasn't running on windows, also got "failed: Bad file descriptor".
     108                    # But making more robust by adding support for any "failed:..." wget response msg
    105109        chomp $line;
    106110        $error_output = $line;
     
    129133
    130134    if(defined $error_output) {
    131     print STDERR "\n\n**** WGET_SERVICE got an error: $error_output\n\n";
     135        if($is_error) {
     136            print STDERR "\n\n**** WGET_SERVICE got an error: $error_output\n\n";
     137        } else {
     138            print STDERR "\n\n**** WGET_SERVICE got: $error_output. (GS3 server likely not running.)\n\n";
     139        }
    132140    }
    133141
     
    416424
    417425    my $server_status = "unknown";
    418 
    419426    if ($self->server_running()) {
     427
    420428    $server_status = "already-running";
    421429    print STDERR "@@@@ server already running\n\n";
Note: See TracChangeset for help on using the changeset viewer.