haproxy fails at startup when using server name instead of IP

Bug #1771335 reported by Bill Waggoner
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
haproxy (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

This is similar to #689734 I believe.

When starting haproxy using a DNS name on the 'server' line haproxy fails to start, giving the message:

```
May 05 19:09:40 hyrule systemd[1]: Starting HAProxy Load Balancer...
May 05 19:09:40 hyrule haproxy[1146]: [ALERT] 124/190940 (1146) : parsing [/etc/haproxy/haproxy.cfg:157] : 'server scanmon' :
May 05 19:09:40 hyrule haproxy[1146]: [ALERT] 124/190940 (1146) : Failed to initialize server(s) addr.
May 05 19:09:40 hyrule systemd[1]: haproxy.service: Control process exited, code=exited status=1
May 05 19:09:40 hyrule systemd[1]: haproxy.service: Failed with result 'exit-code'.
May 05 19:09:40 hyrule systemd[1]: Failed to start HAProxy Load Balancer.
```

In this case the server statement was:

` server scanmon myservername.mydomain.org:8000`

Changing it to use the IP address corrected the problem.

I believe there is a missing dependency for DNS in the unit file.

--Info:
Description: Ubuntu 18.04 LTS
Release: 18.04

haproxy:
  Installed: 1.8.8-1
  Candidate: 1.8.8-1
  Version table:
 *** 1.8.8-1 500
        500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks for filing this bug in Ubuntu.

I tried a simple case of bringing up two lxd containers, one with haproxy as the frontend, another one with just apache as the backend, and this config file on the frontend:

(defaults from the package go here)
frontend mycontainer
 bind *:9090
 mode http
 default_backend myapache

backend myapache
 mode http
 balance roundrobin
 server apache-1 bionic-backend.lxd:80 check

I then rebooted this frontend and it picked up the bionic-backend.lxd ip just fine via dns.

This sounds indeed like some sort of race condition during boot. It happens only after you reboot a machine? After the boot, if you login and issue a "systemctl restart haproxy", it then works?

Could you share some details about the networking setup of this machine? For example:
cat /etc/network/interfaces /etc/network/interfaces.d/*
cat /etc/netplan/*.yaml
cat /etc/hosts
cat /etc/resolv.conf

Also, does this machine have a wired network connection, or does it depend on wifi and someone logging in on gnome to activate network-manager and its wifi connection?

Changed in haproxy (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for haproxy (Ubuntu) because there has been no activity for 60 days.]

Changed in haproxy (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Gustin Johnson (gustin-meganerd) wrote :

I can confirm that I also have this issue. If I ssh into the host and manually issue "systemctl restart haproxy" haproxy runs just fine. I am also using hostnames that resolve via DNS and not /etc/hosts.

This is a headless VM on wired network (KVM bridged network). The IP is assigned via DHCP.

There is nothing in /etc/netplan

/etc/hosts only has the default localhost entries and some IPv6 lines at the end (this network does not have IPv6, only the link local stuff).

/etc/resolv.conf points to the localhost and thus I used:
 sudo systemd-resolve --status
to get the actual DNS server(s), which are correct and functioning as expected.

Any other ideas?

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Do you have fully qualified hostnames in the haproxy config? Or a bare name?

Changed in haproxy (Ubuntu):
status: Expired → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for haproxy (Ubuntu) because there has been no activity for 60 days.]

Changed in haproxy (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.