Patch: backend clobber prevention

Eric Lambrecht eml at guba.com
Thu Oct 12 19:10:03 UTC 2006


I swear I sent this patch out a while ago, but it isn't in the latest 
SVN perlbal code and it just bit us in the butt again, now that we're 
updating to it.

There is a condition where a ClientProxy can be given a new Backend C, 
but its old Backend B retains a reference to the ClientProxy. When the 
Backend B is closed, it tries to null out the ClientProxy's reference to 
the Backend B, but actually ends up clobbering the ClientProxy's 
reference to Backend C. This results in a horrible memory leak when 
you're serving up big files like we are.

Anyway.. the attached patch fixes it.

Eric...
-------------- next part --------------
Index: BackendHTTP.pm
===================================================================
--- BackendHTTP.pm      (revision 559)
+++ BackendHTTP.pm      (working copy)
@@ -138,7 +138,10 @@
 
     # tell our client that we're gone
     if (my $client = $self->{client}) {
-        $client->backend(undef);
+        # don't clobber any other backend
+        if ($client->backend() && $self == $client->backend()) {
+            $client->backend(undef);
+        }
         $self->{client} = undef;
     }


More information about the perlbal mailing list