From cd69a6137837645ca293a9e21da3b4fa8576123a Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Wed, 11 Dec 2024 09:23:28 +0100 Subject: [PATCH] BUG/MINOR: server-state: Fix expiration date of srvrq_check tasks "hold.timeout" was used as expiration date for srvrq_check tasks. But it is not accurrate. The expiration date must be based on the resolution timeouts instead (resolve and retry). The purpose of srvrq_check task is to clean up the server resolution status when outdated info are inherited from the state file. Using "hold.timeout" is not accurrate here because hold timeouts concern the resolution response items not the resolution status of servers. It may be set to a huge value or 0. The expiration date of these tasks must be based on the resolution timeouts instead. So now the ("timeout resolve" + resolve_retries * "timeout retry") value is used. This patch should fix the issue #2816. It must be backported to all stable versions. (cherry picked from commit 647a2906626e9c3d9c3349d338a35798325496f2) Signed-off-by: Willy Tarreau (cherry picked from commit 3746a7d0639ced74bb9f7cff79181be9a0f18e56) Signed-off-by: Christopher Faulet --- src/server_state.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/server_state.c b/src/server_state.c index 4fd052814eef..a7b7b30dd53d 100644 --- a/src/server_state.c +++ b/src/server_state.c @@ -426,7 +426,9 @@ static void srv_state_srv_update(struct server *srv, int version, char **params) /* insert in tree and set the srvrq expiration date */ ebis_insert(&srv->srvrq->named_servers, &srv->host_dn); - task_schedule(srv->srvrq_check, tick_add(now_ms, srv->srvrq->resolvers->hold.timeout)); + task_schedule(srv->srvrq_check, tick_add(now_ms, srv->srvrq->resolvers->timeout.resolve + + srv->srvrq->resolvers->resolve_retries * + srv->srvrq->resolvers->timeout.retry)); /* Unset SRV_F_MAPPORTS for SRV records. * SRV_F_MAPPORTS is unfortunately set by parse_server()