BUG/MEDIUM: server: ensure thread-safety of server runtime creation
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Tue, 20 Apr 2021 15:09:08 +0000 (17:09 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 21 Apr 2021 09:00:30 +0000 (11:00 +0200)
commitcece9186251a052a17ded4891815f657b52014c6
tree9fd3dad2e25b2ef12c6ce95ef2d2d430eab31598
parentd688e01032737ce302ba22315110013f25eb034f
BUG/MEDIUM: server: ensure thread-safety of server runtime creation

cli_parse_add_server can be executed in parallel by several CLI
instances and so must be thread-safe. The critical points of the
function are :
- server duplicate detection
- insertion of the server in the proxy list

The mode of operation has been reversed. The server is first
instantiated and parsed. The duplicate check has been moved at the end
just before the insertion in the proxy list, under the thread isolation.
Thus, the thread safety is guaranteed and server allocation is kept
outside of locks/thread isolation.
src/server.c