BUG/MEDIUM: servers: Use atomic operations when handling curr_idle_conns.
Use atomic operations when dealing with srv->curr_idle_conns, as it's shared
between threads, otherwise we could get inconsistencies.
This should be backported to 1.9.
diff --git a/src/backend.c b/src/backend.c
index 1fd66f9..3c752a2 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -1343,7 +1343,7 @@
if (reuse && reuse_orphan) {
LIST_DEL(&srv_conn->list);
srv_conn->idle_time = 0;
- srv->curr_idle_conns--;
+ HA_ATOMIC_SUB(&srv->curr_idle_conns, 1);
LIST_ADDQ(&srv->idle_conns[tid], &srv_conn->list);
if (LIST_ISEMPTY(&srv->idle_orphan_conns[tid]))
task_unlink_wq(srv->idle_task[tid]);