]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: server: close a race around ready_srv when deleting a server
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Nov 2025 18:52:10 +0000 (19:52 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Nov 2025 18:57:44 +0000 (19:57 +0100)
commit0144426dfb1281f76f5885146035049bedbb494b
tree45ccc6c8d9eebc2e797acebe0ec3bdbcb7aedc11
parentc6f68901ccaddddca760bd45e6869161f4f7f846
BUG/MEDIUM: server: close a race around ready_srv when deleting a server

When a server is being disabled or deleted, in case it matches the
backend's ready_srv, this one is reset. However it's currently done in
a non-atomic way when the server goes down, and that could occasionally
reset the entry matching another server, but more importantly if in
parallel some requests are dequeued for that server, it may re-appear
there after having been removed, leading to a possible crash once it
is fully removed, as shown in issue #3177.

Let's make sure we reset the pointer when detaching the server from
the proxy, and use a CAS in both cases to only reset this server.

This fix needs to be backported to 3.2. There, srv_detach() is in
server.c instead of server.h. Thanks to Basha Mougamadou for the
detailed report and the useful backtraces.
include/haproxy/server.h
src/server.c