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 ?

> 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"

Hoping this helps,
Willy


Reply via email to