Changeset 814

Show
Ignore:
Timestamp:
02/11/09 21:35:24 (10 months ago)
Author:
hachi
Message:

Prevent a complex crash scenario.

I have an unautomated test that gets perlbal to crash right now, will make an automated test out of it tomorrow.

If perlbal has a service selector, performs a reproxy, and throws an error in the reproxy setup routine that gets shown to the user perlbal will crash because ->next_request on the backend doesn't get called until after the reproxy setup. Basically since the backend has made a successful response to us we should detach it from our client earlier, so that errors in the client can't cause us to end up in a mixed state.

This is the proper fix for the duck-typing fix I made in a branch a few weeks ago.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/Perlbal/BackendHTTP.pm

    r772 r814  
    475475    if ((my $rep = $hd->header('X-REPROXY-FILE')) && $self->may_reproxy) { 
    476476        # make the client begin the async IO while we move on 
     477        $self->next_request; 
    477478        $client->start_reproxy_file($rep, $hd); 
     479        return; 
     480    } elsif ((my $urls = $hd->header('X-REPROXY-URL')) && $self->may_reproxy) { 
    478481        $self->next_request; 
    479         return; 
    480     } elsif ((my $urls = $hd->header('X-REPROXY-URL')) && $self->may_reproxy) { 
    481482        $self->{service}->add_to_reproxy_url_cache($rqhd, $hd) 
    482483            if $reproxy_cache_for; 
    483         $client->start_reproxy_uri($self->{res_headers}, $urls); 
     484        $client->start_reproxy_uri($hd, $urls); 
     485        return; 
     486    } elsif ((my $svcname = $hd->header('X-REPROXY-SERVICE')) && $self->may_reproxy) { 
    484487        $self->next_request; 
    485         return; 
    486     } elsif ((my $svcname = $hd->header('X-REPROXY-SERVICE')) && $self->may_reproxy) { 
    487488        $self->{client} = undef; 
    488         $client->start_reproxy_service($self->{res_headers}, $svcname); 
    489         $self->next_request; 
     489        $client->start_reproxy_service($hd, $svcname); 
    490490        return; 
    491491    } elsif ($res_code == 500 &&