MEDIUM: server: close idle conn on server deletion
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 13 Mar 2024 10:33:50 +0000 (11:33 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 22 Mar 2024 15:59:02 +0000 (16:59 +0100)
commit6e0afb2e274952663957121ea33cb6bae574fc2e
tree1362b9d3b3e7f20018e8a3b892a398bb50083d80
parentf3862a9bc722fe1de705c1f0b2cacb959f3617a9
MEDIUM: server: close idle conn on server deletion

To be able to delete a server, a number of preconditions must be
validated to ensure it is not in used anymore. Previously, if idle
connections were stored in the server, the deletion was cancelled. No
action was implemented to force idle connection closure, the only
solution was to wait for the periodic purging to be achieved.

This is an extra burden to be able to delete a server. Indeed, idle
connections are by definition inactive and can be closed prior to delete
a server. This is the exact purpose of this patch.

Idle connections removal is implemented inside "delete server" handler,
once it has been determined that the server can be freely removed. A
simple loop is run to call conn_release() over each idle connections.
Takeover is also executed before conn_release() to ensure tasks/tasklets
or any other sensible elements are not deleted from a foreign thread.

This patch should reduce the occurence of rejected "delete server"
execution, especially when connection reuse is high.
src/server.c