]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MINOR: listener: really assign distinct IDs to shards
authorWilly Tarreau <w@1wt.eu>
Wed, 9 Jul 2025 13:52:33 +0000 (15:52 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 9 Jul 2025 13:52:33 +0000 (15:52 +0200)
commitdd49f1ee6230eaf608f3afa880ef0a6d2b84456e
tree31c1969e2f915f94947c10fb4682f6ad9b42f5a0
parentadba8ffb49b9cd9e292c92818a4efbe206d7dcad
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.
src/listener.c