mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 07:07:04 +02:00
BUG/MINOR: listener: really assign distinct IDs to shards
A fix was made in 3.0 for the case where sharded listeners were using
a same ID with commit 0db8b6034d
("BUG/MINOR: listener: always assign
distinct IDs to shards"). However, the fix is incorrect. By checking the
ID of temporary node instead of the kept one in bind_complete_thread_setup()
it ends up never inserting the used nodes at this point, thus not reserving
them. The side effect is that assigning too close IDs to subsequent
listeners results in the same ID still being assigned twice since not
reserved. Example:
global
nbthread 20
frontend foo
bind :8000 shards by-thread id 10
bind :8010 shards by-thread id 20
The first one will start a series from 10 to 29 and the second one a
series from 20 to 39. But 20 not being inserted when creating the shards,
it will remain available for the post-parsing phase that assigns all
unassigned IDs by filling holes, and two listeners will have ID 20.
By checking the correct node, the problem disappears. The patch above
was marked for backporting to 2.6, so this fix should be backported that
far as well.
This commit is contained in:
parent
adba8ffb49
commit
dd49f1ee62
@ -1856,7 +1856,7 @@ int bind_complete_thread_setup(struct bind_conf *bind_conf, int *err_code)
|
||||
new_li->luid = new_li->conf.id.key = tmp_li->luid;
|
||||
tmp_li->luid = 0;
|
||||
eb32_delete(&tmp_li->conf.id);
|
||||
if (tmp_li->luid)
|
||||
if (new_li->luid)
|
||||
eb32_insert(&fe->conf.used_listener_id, &new_li->conf.id);
|
||||
new_li = tmp_li;
|
||||
}
|
||||
@ -1880,7 +1880,7 @@ int bind_complete_thread_setup(struct bind_conf *bind_conf, int *err_code)
|
||||
new_li->luid = new_li->conf.id.key = li->luid;
|
||||
li->luid = 0;
|
||||
eb32_delete(&li->conf.id);
|
||||
if (li->luid)
|
||||
if (new_li->luid)
|
||||
eb32_insert(&fe->conf.used_listener_id, &new_li->conf.id);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user