Service Discovery using DNS and SRV,Is it good on 2.4?

A haproxy runs in docker, use dns and srv records for service discovery, but it seems dosen’t check my service‘s status even if i have configed health check.

docker-compose.yml

services:
  haproxy:
    image: haproxy:2.4-alpine
    container_name: haproxy
    user: root
    network_mode: "host"
    volumes:
      - ./haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
    restart: unless-stopped
    logging:
      driver: journald

haproxy.cfg:

resolvers ldns
  nameserver dns1 127.0.0.1:53

global
	chroot /var/empty
	user haproxy
	group haproxy

	stats socket /var/run/haproxy-svc1.sock level admin mode 600

	log stdout format raw daemon

defaults http
	mode http
	default-server init-addr none resolvers ldns
	option forwardfor
	option httplog
	log global
	timeout client 1m
	timeout server 1m
	timeout connect 10s
	timeout http-keep-alive 2m

frontend stats
	bind :::8181
	stats enable
	stats uri /
	stats show-modules
	
frontend pub1
	bind :::7090 name clear

	http-response add-header Access-Control-Allow-Origin "*"

	use_backend be_app4test if { path_beg -i /app4test/ }

backend be_app4test
    option httpchk GET /check
    http-check expect status 404
    server-template srv 1 _app4test._tcp.h5.lc check

After I run haproxy, it logs

haproxy    | [NOTICE]   (1) : New worker #1 (8) forked
haproxy    | be_app4test/srv1 changed its FQDN from (null) to localhost by 'SRV record'

No info shows my service is ready and my service didn’t receive any “/check” request neither. so I can’t request my service via front pub1. http://127.0.0.1:7090/app4test/pp haproxy response 503 servive unavailable

/# curl http://127.0.0.1:7090/app4test/pp
<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>

SRV record

/# dig @127.0.0.1 srv _app4test._tcp.h5.lc

; <<>> DiG 9.16.15-Debian <<>> @127.0.0.1 srv _app4test._tcp.h5.lc
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26702
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 91edd15262f8054201000000616d48f4f6a315c9e015c81c (good)
;; QUESTION SECTION:
;_app4test._tcp.h5.lc.          IN      SRV

;; ANSWER SECTION:
_app4test._tcp.h5.lc.   10      IN      SRV     10 90 34593 localhost.

;; Query time: 0 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Oct 18 06:14:12 EDT 2021
;; MSG SIZE  rcvd: 106

Health check reponse 404 as config.

/root/dd/ha# curl -v http://127.0.0.1:34593/check
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 34593 (#0)
> GET /check HTTP/1.1
> Host: 127.0.0.1:34593
> User-Agent: curl/7.52.1
> Accept: */*
>
< HTTP/1.1 404 Not Found
< Content-Type: text/plain
< Date: Mon, 18 Oct 2021 10:25:45 GMT
< Content-Length: 18
<
* Curl_http_done: called premature == 0
* Connection #0 to host 127.0.0.1 left intact
404 page not found

I was thinking where i went wrong or there is a bug here.

And when I delete the srv record on my dns server, it print logs below, Is this normal?

[NOTICE]   (1) : haproxy version is 2.4.7-b5e51a5
[ALERT]    (1) : Current worker #1 (8) exited with code 139 (Segmentation fault)
[ALERT]    (1) : exit-on-failure: killing every processes with SIGTERM
[WARNING]  (1) : All workers exited. Exiting... (139)
[NOTICE]   (1) : New worker #1 (7) forked

My fault, sorry, I close it. :sweat_smile: