I’m experiencing an issue with the connection between my PostgreSQL database (a cluster managed by Patroni) and HAProxy. Everything in the application that uses the database works fine, and I don't see any issues, but HAProxy generates a lots of disturbing logs:
2025-02-21T15:27:07.368101+01:00 haproxy-psql-01 haproxy[391178]: xx.xx.xx.xx:37806 [21/Feb/2025:15:27:07.314] postgres_front postgres_back/psql-01 1/0/53 131982 SD 43/43/42/42/0 0/0 2025-02-21T15:27:07.368197+01:00 haproxy-psql-01 haproxy[391178]: xx.xx.xx.xx:37806 [21/Feb/2025:15:27:07.314] postgres_front postgres_back/psql-01 1/0/53 131982 SD 43/43/42/42/0 0/0 2025-02-21T15:27:10.440445+01:00 haproxy-psql-01 haproxy[391178]: xx.xx.xx.xx:37826 [21/Feb/2025:15:27:10.380] postgres_front postgres_back/psql-01 1/0/59 134940 SD 44/44/43/43/0 0/0 2025-02-21T15:27:10.440669+01:00 haproxy-psql-01 haproxy[391178]: xx.xx.xx.xx:37826 [21/Feb/2025:15:27:10.380] postgres_front postgres_back/psql-01 1/0/59 134940 SD 44/44/43/43/0 0/0 2025-02-21T15:27:10.451244+01:00 haproxy-psql-01 haproxy[391178]: xx.xx.xx.xx:37816 [21/Feb/2025:15:27:10.377] postgres_front postgres_back/psql-01 1/0/74 159457 SD 43/43/42/42/0 0/0 2025-02-21T15:27:10.451296+01:00 haproxy-psql-01 haproxy[391178]: xx.xx.xx.xx:37816 [21/Feb/2025:15:27:10.377] postgres_front postgres_back/psql-01 1/0/74 159457 SD 43/43/42/42/0 0/0 2025-02-21T15:27:12.477624+01:00 haproxy-psql-01 haproxy[391178]: xx.xx.xx.xx:37832 [21/Feb/2025:15:27:12.382] postgres_front postgres_back/psql-01 1/0/95 172320 SD 43/43/42/42/0 0/0
all connections are terminated with SD
state. I have to add that, on Postgres is enabled SSL
mode which is an important detail because, when I turn that off, all states ended perfectly, with --
state. However, whether SSL
is enabled or disabled, the application using the database behaves the same way.
Sometimes I get that error only in app logs:
[Z3005] query failed: [0] PGRES_FATAL_ERROR:SSL SYSCALL error: EOF detected
Here is a HAProxy config:
global maxconn 6000 log /dev/log local0 # log /dev/log local1 notice log /dev/log local1 info chroot /var/lib/haproxy user haproxy group haproxy daemon stats socket /var/lib/haproxy/stats defaults log global option log-health-checks mode tcp option tcplog option tcpka retries 2 timeout client 30m timeout connect 4s timeout server 30m timeout check 5s timeout queue 1m log global maxconn 3000 frontend stats mode http bind *:8404 stats enable stats uri /stats stats refresh 10s frontend postgres_front bind *:5432 mode tcp default_backend postgres_back backend postgres_back mode tcp option tcp-check option httpchk GET /primary http-check expect status 200 default-server inter 3s fall 5 rise 2 on-marked-down shutdown-sessions server psql-01 xx.xx.xx.xx:5432 maxconn 1000 check port 8008 check-ssl verify none server psql-02 xx.xx.xx.xx:5432 maxconn 1000 check port 8008 check-ssl verify none server psql-03 xx.xx.xx.xx:5432 maxconn 1000 check port 8008 check-ssl verify none
HAProxy version: HAProxy version 2.8.5-1ubuntu3.2 2024/12/02
Do you know how to resolve this problem, should I be worried about this log output?
I tried sending SSL certificates and even regenerating new ones, but that not helps. When I bypass HAProxy, everything works fine (use IP address of active database node), any errors in app log. Additionally, when I disable SSL on PostgreSQL, all states end in the desired state.
regards