From: Nick Porter Date: Tue, 4 Jun 2024 07:42:42 +0000 (+0100) Subject: Don't close the final connection on a trunk if the last event was a failure X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e0ebfbc49dbb26752e2a4764f9b5db1db2f9c3d8;p=thirdparty%2Ffreeradius-server.git Don't close the final connection on a trunk if the last event was a failure Closing this last connection can lead to no active connections and the last event being a failure, which then blocks enqueueing of new requests. --- diff --git a/src/lib/server/trunk.c b/src/lib/server/trunk.c index f8c61fb7fbf..c0cc9d60ff0 100644 --- a/src/lib/server/trunk.c +++ b/src/lib/server/trunk.c @@ -4369,6 +4369,19 @@ static void trunk_manage(fr_trunk_t *trunk, fr_time_t now) return; } + /* + * If the last event on the trunk was a connection failure and + * there is only one connection, this may well be a reconnect + * attempt after a failure - and needs to persist otherwise + * the last event will be a failure and no new connection will + * be made, leading to no new requests being enqueued. + */ + if (fr_time_gt(trunk->pub.last_failed, fr_time_wrap(0)) && + fr_time_lt(trunk->pub.last_connected, trunk->pub.last_failed) && (conn_count == 1)) { + DEBUG4("Not closing remaining connection - last event was a failure"); + return; + } + /* * Inactive connections get counted in the * set of viable connections, but are likely