With HAProxy 1.7.3 and later on FreeBSD, recent DNS-related code changes
in HAProxy appear to have broken the UNIX socket in daemon mode when
resolvers are present in the configuration.

How to reproduce:

* Install HAProxy 1.7.x (where x > 2) on FreeBSD 10.3 or FreeBSD 11,
even HAProxy 1.7.5

* Configure HAProxy to provide a UNIX socket for stats:

  stats socket /tmp/haproxy.socket level admin

* Configure HAProxy with resolvers:

    resolvers globalresolvers
        nameserver localdns 10.6.0.1:53
        resolve_retries 3
        timeout retry 1s
        hold valid 10s

* Start haproxy

* Attempt to grab some stats from the UNIX socket (ANY stats, not just
resolver stats!):

  echo "show stat server" | nc -U /tmp/haproxy.socket

* The request never completes, it hangs indefinitely. The above command
is a shorthand way, using it interactively also fails.

If I revert 91a964aae7a405f2752f8be22d669745caa0c16f
eaf96d7a0849b2883e98459f52489d555b6b013c from the HAProxy source and
rebuild HAProxy, it works as expected. The stats command succeeds and it
yields proper output.

If the resolvers section is removed, it works with and without those
commits applied. The resolvers do not even have to be added to any
backend, only defined in the configuration. Adding multiple nameserver
entries does not change the behavior. Removing the resolver parameters
other than nameserver also does not change the behavior.

If the daemon is started in the foreground (without -D, or with -V -db
and so on), it also works. It appears to only be a problem when using
daemon mode (-D).

I posted this over on Discourse before I noticed the message saying to
post bugs on the list instead. The full test configuration is on my post
there[1].

Note that everything I run is FreeBSD so I have not tested this against
a Linux system. It may be a more general problem or it may be isolated
to FreeBSD. Since I only reproduced it on FreeBSD, that's how I stated
the problem.

Thanks in advance for any assistance in getting this solved.

Jim P.

1:
http://discourse.haproxy.org/t/dns-changes-in-1-7-3-break-unix-socket-stats-when-resolvers-are-configured/1222

Reply via email to