mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-03 10:42:07 +00:00
[BUG] url_param hash may return a down server
Jozef Hovan reported a bug sometimes causing a down server to be used in url_param hashing mode. This happens if the following conditions are met : - the backend contains more than one server with at least two of different weights - all servers but one are down - the server which is not down has a weight which does not divide all the other ones Example: 3 servers with 20,20,10, the first one remains up. The problem is caused by an optimisation in recalc_server_map() which only fills the first map slot when only one server is up, because all LB algorithms are optimized to use entry zero when only one server is up... All but url_param. When doing the modulus, we can return a position which is greater than zero and use an entry which still refers to a server which has since been stopped. One solution could be to optimize the url_param algo to proceed as the other ones, but the fact that was wrong implies that we can repeat the same bug later. So let's first correctly initialize the map in order to avoid that trap.
This commit is contained in:
parent
6a8573ef68
commit
4256463b5a
@ -79,9 +79,6 @@ void recalc_server_map(struct proxy *px)
|
||||
case 0: /* no server */
|
||||
px->lbprm.map.state &= ~LB_MAP_RECALC;
|
||||
return;
|
||||
case 1: /* only one server, just fill first entry */
|
||||
tot = 1;
|
||||
break;
|
||||
default:
|
||||
tot = px->lbprm.tot_weight;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user