]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: cleanup idle conns for server in maint already stopped
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 27 Aug 2025 09:27:30 +0000 (11:27 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 28 Aug 2025 12:55:21 +0000 (14:55 +0200)
When a server goes into maintenance mode, its idle connections are
scheduled for an immediate purge. However, this is not the case if the
server is already in stopped state, for example due to a health check
failure.

Adjust _srv_update_status_adm() to ensure that idle connections are
always scheduled for purge when going into maintenance in both cases.

The main advantage of this patch is to ensure consistent behavior for
server maintenance mode.

Note that it will also become necessary as server deletion will be
adjusted with a future patch. Idle connection closure won't be performed
by "del server" handler anymore, so it's important to ensure that a full
cleanup is always performed prior to executing it, else the server may
not be removable during a certain delay.

src/server.c

index d736362f70be901f9f85040db07005fa80b4c977..88e85b724ec126ccd7572114fe68fb995602ff02 100644 (file)
@@ -6799,6 +6799,9 @@ static int _srv_update_status_adm(struct server *s, enum srv_adm_st_chg_cause ca
                                }
                                free_trash_chunk(tmptrash);
                        }
+
+                       /* force connection cleanup on the given server */
+                       srv_cleanup_connections(s);
                }
                else {  /* server was still running */
                        s->check.health = 0; /* failure */