backend.set_health bug

Hettwer, Marian mhettwer at team.mobile.de
Wed Mar 27 16:38:37 CET 2013


Follow up. We're not sure what the code want's to achieve here, but at
least the attached patch let's us use names the way we think it should be
;-)


FWIW,
./Marian

patch by seffenberg at team.mobile.de

On 27.03.13 15:21, "Hettwer, Marian" <mhettwer at team.mobile.de> wrote:

>Hi Ho,
>
>seems like the parser for specifying the backend is buggy.
>Should I file a bug report?
>
>But first the details. Look what's happening.
>
>We have this backend list:
>
>varnish> backend.list
>200        
>Backend name                   Refs   Admin      Probe
>speedy(10.47.28.60,,9062)      1      probe      Healthy 5/5
>speedy(10.47.28.61,,9062)      1      probe      Sick 0/5
>speedy47_1(10.47.60.1,,9062)   1      probe      Healthy 8/8
>speedy47_10(10.47.60.10,,9062) 1      probe      Healthy 8/8
>speedy47_11(10.47.60.11,,9062) 1      probe      Healthy 8/8
>speedy47_12(10.47.60.12,,9062) 1      probe      Healthy 8/8
>speedy47_13(10.47.60.13,,9062) 1      probe      Healthy 8/8
>speedy47_14(10.47.60.14,,9062) 1      probe      Healthy 8/8
>speedy47_15(10.47.60.15,,9062) 1      probe      Healthy 8/8
>speedy47_16(10.47.60.16,,9062) 1      probe      Healthy 8/8
>speedy47_17(10.47.60.17,,9062) 1      probe      Healthy 8/8
>speedy47_18(10.47.60.18,,9062) 1      probe      Healthy 8/8
>speedy47_2(10.47.60.2,,9062)   1      probe      Healthy 8/8
>speedy47_3(10.47.60.3,,9062)   1      probe      Healthy 8/8
>speedy47_4(10.47.60.4,,9062)   1      probe      Healthy 8/8
>speedy47_5(10.47.60.5,,9062)   1      probe      Healthy 8/8
>speedy47_6(10.47.60.6,,9062)   1      probe      Healthy 8/8
>speedy47_7(10.47.60.7,,9062)   1      probe      Healthy 8/8
>speedy47_8(10.47.60.8,,9062)   1      probe      Healthy 8/8
>speedy47_9(10.47.60.9,,9062)   1      probe      Healthy 8/8
>
>And are now setting speedy47_1 to sick:
>
>varnish> backend.set_health speedy47_1(10.47.60.1) sick
>200        
>
>
>Now let's have a look at the backend list:
>
>varnish> backend.list
>200        
>Backend name                   Refs   Admin      Probe
>speedy(10.47.28.60,,9062)      1      probe      Healthy 5/5
>speedy(10.47.28.61,,9062)      1      probe      Sick 0/5
>speedy47_1(10.47.60.1,,9062)   1      sick       Healthy 8/8
>speedy47_10(10.47.60.10,,9062) 1      sick       Healthy 8/8
>speedy47_11(10.47.60.11,,9062) 1      sick       Healthy 8/8
>speedy47_12(10.47.60.12,,9062) 1      sick       Healthy 8/8
>speedy47_13(10.47.60.13,,9062) 1      sick       Healthy 8/8
>speedy47_14(10.47.60.14,,9062) 1      sick       Healthy 8/8
>speedy47_15(10.47.60.15,,9062) 1      sick       Healthy 8/8
>speedy47_16(10.47.60.16,,9062) 1      sick       Healthy 8/8
>speedy47_17(10.47.60.17,,9062) 1      sick       Healthy 8/8
>speedy47_18(10.47.60.18,,9062) 1      sick       Healthy 8/8
>speedy47_2(10.47.60.2,,9062)   1      probe      Healthy 8/8
>speedy47_3(10.47.60.3,,9062)   1      probe      Healthy 8/8
>speedy47_4(10.47.60.4,,9062)   1      probe      Healthy 8/8
>speedy47_5(10.47.60.5,,9062)   1      probe      Healthy 8/8
>speedy47_6(10.47.60.6,,9062)   1      probe      Healthy 8/8
>speedy47_7(10.47.60.7,,9062)   1      probe      Healthy 8/8
>speedy47_8(10.47.60.8,,9062)   1      probe      Healthy 8/8
>speedy47_9(10.47.60.9,,9062)   1      probe      Healthy 8/8
>
>
>
>Oh No! I only wanted one backend to go sick. Damn.
>
>Let's try Name, IP address and port instead...
>
>varnish> backend.list
>200        
>Backend name                   Refs   Admin      Probe
>speedy(10.47.28.60,,9062)      1      probe      Healthy 5/5
>speedy(10.47.28.61,,9062)      1      probe      Sick 0/5
>speedy47_1(10.47.60.1,,9062)   1      sick       Healthy 8/8
>speedy47_10(10.47.60.10,,9062) 1      sick       Healthy 8/8
>speedy47_11(10.47.60.11,,9062) 1      sick       Healthy 8/8
>speedy47_12(10.47.60.12,,9062) 1      sick       Healthy 8/8
>speedy47_13(10.47.60.13,,9062) 1      sick       Healthy 8/8
>speedy47_14(10.47.60.14,,9062) 1      sick       Healthy 8/8
>speedy47_15(10.47.60.15,,9062) 1      sick       Healthy 8/8
>speedy47_16(10.47.60.16,,9062) 1      sick       Healthy 8/8
>speedy47_17(10.47.60.17,,9062) 1      sick       Healthy 8/8
>speedy47_18(10.47.60.18,,9062) 1      sick       Healthy 8/8
>speedy47_2(10.47.60.2,,9062)   1      probe      Healthy 8/8
>speedy47_3(10.47.60.3,,9062)   1      probe      Healthy 8/8
>speedy47_4(10.47.60.4,,9062)   1      probe      Healthy 8/8
>speedy47_5(10.47.60.5,,9062)   1      probe      Healthy 8/8
>speedy47_6(10.47.60.6,,9062)   1      probe      Healthy 8/8
>speedy47_7(10.47.60.7,,9062)   1      probe      Healthy 8/8
>speedy47_8(10.47.60.8,,9062)   1      probe      Healthy 8/8
>speedy47_9(10.47.60.9,,9062)   1      probe      Healthy 8/8
>varnish> backend.set_health speedy47_1(10.47.60.1:9062) auto
>200        
>
>varnish> backend.list
>200        
>Backend name                   Refs   Admin      Probe
>speedy(10.47.28.60,,9062)      1      probe      Healthy 5/5
>speedy(10.47.28.61,,9062)      1      probe      Sick 0/5
>speedy47_1(10.47.60.1,,9062)   1      probe      Healthy 8/8
>speedy47_10(10.47.60.10,,9062) 1      probe      Healthy 8/8
>speedy47_11(10.47.60.11,,9062) 1      probe      Healthy 8/8
>speedy47_12(10.47.60.12,,9062) 1      probe      Healthy 8/8
>speedy47_13(10.47.60.13,,9062) 1      probe      Healthy 8/8
>speedy47_14(10.47.60.14,,9062) 1      probe      Healthy 8/8
>speedy47_15(10.47.60.15,,9062) 1      probe      Healthy 8/8
>speedy47_16(10.47.60.16,,9062) 1      probe      Healthy 8/8
>speedy47_17(10.47.60.17,,9062) 1      probe      Healthy 8/8
>speedy47_18(10.47.60.18,,9062) 1      probe      Healthy 8/8
>speedy47_2(10.47.60.2,,9062)   1      probe      Healthy 8/8
>speedy47_3(10.47.60.3,,9062)   1      probe      Healthy 8/8
>speedy47_4(10.47.60.4,,9062)   1      probe      Healthy 8/8
>speedy47_5(10.47.60.5,,9062)   1      probe      Healthy 8/8
>speedy47_6(10.47.60.6,,9062)   1      probe      Healthy 8/8
>speedy47_7(10.47.60.7,,9062)   1      probe      Healthy 8/8
>speedy47_8(10.47.60.8,,9062)   1      probe      Healthy 8/8
>speedy47_9(10.47.60.9,,9062)   1      probe      Healthy 8/8
>
>Again, matched all. Meeeeep!
>
>
>
>hm. Looks like something is wrong down here in the code:
>
>bin/varnishd/cache/cache_backend_cfg.c
>367     if (port_b != NULL && strncmp(b->port, port_b, port_l) != 0)
>369     if (name_b != NULL && strncmp(b->vcl_name, name_b, name_l) != 0)
>373           strncmp(b->ipv4_addr, ip_b, ip_l)) &&
>375           strncmp(b->ipv6_addr, ip_b, ip_l)))
>
>should also take the strlen(b->port)... into account.
>
>Example:
>367     if (port_b != NULL && strlen(b->port) == port_l &&
>strncmp(b->port, port_b, port_l) != 0)
>
>
>
>best regards,
>Marian
>
>
>_______________________________________________
>varnish-misc mailing list
>varnish-misc at varnish-cache.org
>https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-backend-matcher.patch
Type: application/octet-stream
Size: 1113 bytes
Desc: fix-backend-matcher.patch
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20130327/ed1694ef/attachment.obj>


More information about the varnish-misc mailing list