ClientProxy detection fix

dormando dormando at
Wed Oct 25 17:24:00 UTC 2006


The attached patch has stopped perlbal from crashing on me. It's run 
overnight without further issues on my test instance, so I'm rolling it 
out to the other 23.

This isn't a real fix... It's more ineffecient and doesn't really fix 
the actual problem. I think what needs to happen is's 
http_response_close needs to actually undef itself out of an attached 
backend if one exists. However, I'm not 100% positive that's a good fix 
either, so I'll wait for some feedback if possible :(

It might still be possible that the issue's the adopt_base_client not 
getting called right in some circumstances, but I'm doubting it...

-------------- next part --------------
diff -ur Perlbal-1.51.orig/lib/Perlbal/ Perlbal-1.51/lib/Perlbal/
--- Perlbal-1.51.orig/lib/Perlbal/	2006-09-06 14:12:32.000000000 -0700
+++ Perlbal-1.51/lib/Perlbal/	2006-10-25 10:06:06.000000000 -0700
@@ -135,8 +135,9 @@
     # tell our client that we're gone
+    # the client may reset before we get here
     if (my $client = $self->{client}) {
-        $client->backend(undef);
+        $client->backend(undef) if $client->isa('Perlbal::ClientProxy');
         $self->{client} = undef;
@@ -475,7 +476,9 @@
     # to use the end of the stream, or because a bad request error,
     # which I can't totally understand.  in any case, we have
     # no client so all we can do is close this backend.
-    return $self->close('read_with_no_client') unless $client;
+    unless ($client && $client->isa('Perlbal::ClientProxy')) {
+      return $self->close('read_with_no_client');
+    }
     unless ($self->{res_headers}) {
         return unless $self->read_response_headers;

More information about the perlbal mailing list