Repository navigation
2.3.2: tcp:// services keep their connections for as long as they say
A fix for tcp:// services, from #35. Nothing changes for HTTP services.
What was wrong
A tcp:// service with a Server timeout of, say, 30 minutes still lost its connections after 50 seconds. HAProxy holds each half of a TCP connection to its own timeout, and only the server half got the service's value; the listener kept the 50 s client timeout that stands for everything. An idle database session was cut after 50 s, and so was a query that ran longer than that. Every tcp:// recipe sets a long server timeout and was affected.
What changed
The Server timeout of a tcp:// service is now also written as the pool's timeout tunnel, which replaces both halves:
backend be_pg
mode tcp
timeout server 30m
timeout tunnel 30m
It takes effect at the next Apply after the update. Connections on tcp:// services then live as long as the Server timeout says, which is longer than before.
- A
tcp://service without a Server timeout of its own is unchanged: it keeps the client and server timeouts under Advanced · HAProxy › Settings. - A pool with its own
timeout tunnelin Extra directives keeps that one. - A
timeout clientadded to a listener's Extra directives as a workaround is no longer needed and can be removed.
The guide's Tuning page describes it.
Tested
On the container image (HAProxy 3.4), with a 30 minute Server timeout: an idle connection and a connection waiting on a silent server were both cut at 50.0 s on 2.3.1, and were still open at 70 s with the fix. A 10 s Server timeout still cuts at 10 s. The two configuration lines were also checked on HAProxy 3.0. Not tried: a package install under systemd, which generates the same configuration.