LVS
lvs-users
Google
 
Web LinuxVirtualServer.org

Re: patch for nasty ldirectord bug

To: Branko F. Gračnar <bfg@xxxxxxxxxxxx>
Subject: Re: patch for nasty ldirectord bug
Cc: lvs-users@xxxxxxxxxxxxxxxxxxxxxx
From: Horms <horms@xxxxxxxxxxxx>
Date: Mon, 30 Jan 2006 15:31:40 +0900
On Thu, Jan 26, 2006 at 04:21:43PM +0100, Branko F. Gračnar wrote:
> Hellow ;)
> 
> I found a nasty bug in ldirectord code, which led our lvs setup to work 
> improperly - some http "real" servers were not checked becouse of "check 
> caching" feature in ldirectord.
> 
> I think, that this is a critical bug, which should be fixed immediately.
> 
> This bug shows up in the following scenario in ldirector.cf:
> 
> 
> --- snip ---
> virtual=T.Z.U.P:80
>         real=a.b.c.d:80 masq 1
>         real=e.f.g.h:80 masq 1
>         service=http
>         virtualhost="www.domain1.tld"
>         request="/testme.php?q=test"
>         receive="success string"
>         scheduler=lc
>         persistent=600
>         protocol=tcp
>         checktype=negotiate
> 
> virtual=T.Z.U.A:80
>         real=a.b.c.d:80 masq
>         real=e.f.g.h:80 masq
>         service=http
>         virtualhost="www.domain2.tld"
>         request="/testme.php?q=test"
>         receive="success string"
>         scheduler=lc
>         persistent=600
>         protocol=tcp
>         checktype=negotiate
> 
> virtual=T.Z.U.S:80
>         real=a.b.c.d:80 masq
>         real=e.f.g.h:80 masq
>         service=http
>         virtualhost="www.domain3.tld"
>         request="/testme.php?q=test"
>         receive="success string"
>         scheduler=lc
>         persistent=600
>         protocol=tcp
>         checktype=negotiate
> 
> virtual=T.Z.U.D:80
>         real=a.b.c.d:80 masq
>         real=e.f.g.h:80 masq
>         service=http
>         virtualhost="www.domain4.tld"
>         request="/testme.php?q=test"
>         receive="success string"
>         scheduler=lc
>         persistent=600
>         protocol=tcp
>         checktype=negotiate
> --- snip ---
> 
> How to reproduce:
> 
> Well, the bug shows up, when some real servers serve several different 
> virtualhosts (in case of http lvs), and LVS virtual servers are configured 
> almost identically.
> 
> Ofcourse, this bug would not trigger if each and every lvs virtual server 
> would have different "request" parameter.
> 
> Impact: all real servers are added to lvs virtual servers, but not all are 
> actually checked for proper operation (Already checked: real server= debug3 
> message).

Thanks.

I think that a better fix would be to make the id_string of the virtual
include the virtualhost parameter. This way the caching could be shared
between virtual services. Actually, I think that if you make the
caching per-virtual then it should be removed, because I don't think
it will ever get a hit.

> Patch:
> Trivial patch is attached.
> 
> Tested versions: 1.77.2.1 2004/04/20 05:05:29, 1.129 2006/01/15 16:25:19
> 
> Best regards, Brane

> --- ldirectord.orig   2006-01-26 01:16:09.000000000 +0100
> +++ ldirectord        2006-01-26 01:17:09.000000000 +0100
> @@ -1475,8 +1475,8 @@
>  {
>       # Main failover checking code
>       while (1) {
> -             my @real_checked;
>               foreach my $v (@VIRTUAL) {
> +                     my @real_checked;
>                       my $real = $$v{real};
>                       my $virtual_id = get_virtual_id_str($v);
>  


-- 
Horms

<Prev in Thread] Current Thread [Next in Thread>