HAProxy 2.0.12 send-proxy fails when used with server-template

Hi there,

Im having a strange issue when trying to use “send-proxy” and “check” together along side a “server-template” entry (using SRV DNS to get the server addresses / ports).

When including send-proxy and check in the server-template line as shown below haproxy fails to start without any error reported.
If I remove the server-template line and specify the servers directly in the config “send-proxy check” works fine (commented out lines below).
If I remove send-proxy from the server-template line everything works (except I get no proxy protocol which I would like)

Im using version 2.0.12 on Ubuntu 18.04 from the PPA packages.

Have I uncovered a bug or is there something wrong with my config.

My frontend and backend config is below (with changed IPs / domains etc). No errors / warnings are displayed on the console when I run this config.

#Config below
resolvers mydns
nameserver dns1 10.0.0.1:53
nameserver dns2 10.0.0.2:53

frontend ft_test
bind 10.0.0.5:1234
mode tcp
no option http-server-close
timeout client 30s
log global
option tcplog
default_backend bk_test

backend bk_test
mode tcp
balance roundrobin
no option http-server-close
log global
timeout server 30s
timeout connect 5s
option tcp-check
server-template test 3 _myservice._tcp.subdomain.example.com resolvers mydns send-proxy check init-addr none
#server test1 10.0.0.11:1234 send-proxy check
#server test2 10.0.0.10:1234 send-proxy check
#End Config

Thanks in advance,
Nic.

Please run sudo haproxy -f /etc/haproxy.cfg -c to error check the config (when send-proxy is configured and the haproxy start fails).

Also please provide the output of systemctl status haproxy after such failure.

Config check:
root@hap1:/etc/haproxy# haproxy -f /etc/haproxy/haproxy.cfg -c
Configuration file is valid

systemd just restarts the failed service so its hard to see the actual error. if I disable the systemd haproxy.service and just run it from command line with the same options I get the following seg-fault.

root@hap1:/etc/haproxy# /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.sock
[NOTICE] 363/000938 (11246) : New worker #1 (11247) forked
[ALERT] 363/000938 (11246) : Current worker #1 (11247) exited with code 139 (Segmentation fault)
[ALERT] 363/000938 (11246) : exit-on-failure: killing every processes with SIGTERM
[WARNING] 363/000938 (11246) : All workers exited. Exiting… (139)

Same config with send-proxy removed gives the following (which is expected in terms of state).

root@hap1:/etc/haproxy# /usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.sock
[NOTICE] 363/001123 (11255) : New worker #1 (11256) forked
[WARNING] 363/001123 (11256) : Server bk_test/test1 is DOWN, reason: Socket error, info: " at initial connection step of tcp-check", check duration: 0ms. 2 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[WARNING] 363/001123 (11256) : bk_test/test2 changed its IP from to 10.0.0.12 by mydns/dns1.
[WARNING] 363/001123 (11256) : bk_test/test1 changed its IP from to 10.0.0.11 by mydns/dns1.
[WARNING] 363/001125 (11256) : Server bk_test/test3 is DOWN, reason: Socket error, info: " at initial connection step of tcp-check", check duration: 0ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[WARNING] 363/001127 (11256) : Server bk_test/test1 is UP, reason: Layer7 check passed, code: 0, info: “(tcp-check)”, check duration: 3ms. 2 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.
… process continues to run here.

Thanks again :slight_smile:
Nic.

Hell Nic,

this is a bug, I have filed an issue on the bugtracker with some details:

This affects all 2.0 releases and later. 1.9 and older is not affected. I don’t see any workarounds for this right now, expect to downgrade to 1.9 or avoid the configuration entirely.

Thanks for your detailed report!