backend.set_health bug

Hettwer, Marian mhettwer at team.mobile.de
Wed Mar 27 15:21:39 CET 2013


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




More information about the varnish-misc mailing list