Hi Willy, > On Mar 10, 2025, at 15:12, Willy Tarreau <w...@1wt.eu> wrote: > > Hi Luke, > > On Mon, Mar 10, 2025 at 12:54:51PM +0700, Luke Seelenbinder wrote: >> Hi all, >> >> Thanks for confirming it should work--based on the feedback, we realized the >> issue is actually not with `nameservers`, but on startup, so this is actually >> init-addr taking precedence. We missed that in the initial analysis. >> >> Our init-addr is `init-addr libc,last,none`. Due to a complex set of factors, >> using libc to resolve a host can simply hang, instead of fail. When HAProxy >> starts up and libc hangs, the startup times out instead of failing with no IP >> (i.e. `none`). > > Ah OK makes sense. That said, if a regular server does not resolve, > normally it doesn't boot. You mean that here it still boots with no > address ?
No, that's the problem; we'd prefer HAProxy to have no IP for a server at boot than to fail to boot, but since libc just hangs instead of failing, it doesn't finish booting, and the startup times out. This ends up creating a service restart cycle. This means the docs are slightly misleading, however? Since `init-addr libc,last,none` results in a hang if libc just hangs vs failing. I don't know if a hard or configurable timeout on the underlying call makes sense? > >> Is there a way to set the timeout for a libc address resolution? We may be >> able to drop `libc` in the init-addr list entirely due to a generally better >> setup now, but it's useful in some cases. > > I'm not aware of any way to tune the libc's resolver, though if there > is, it will be libc-specific, and even specific to the backend used by > the libc. What could be done, however, could indeed be to use a plain > IP address, but passing it via an environment variable in the global > section (or sourced from another file). This may be easier to handle > than hard-coding IP addresses. E.g: > > global > setenv NS1_ADDR tcp@10.11.12.1:5353 > setenv NS2_ADDR tcp@10.11.12.2:5353 > > resolvers > nameserver ns1 "$NS1_ADDR" > nameserver ns2 "$NS2_ADDR" Fair enough. I figured that would be the answer… In that case, I think the best option for us is to remove `libc` entirely, and make sure our failure modes are good enough if it comes up without a backend for a few seconds. — Luke Seelenbinder Stadia Maps | Founder & CEO stadiamaps.com