BUG/MINOR: stream: Decrement server current session counter on L7 retry
When a L7 retry is performed, we must not forget to decrement the current
session counter of the assigned server. Of course, it must only be done if
the current session is already counted on the server, thus if SF_CURR_SESS
flag is set on the stream.
This patch is related to the issue #1003. It must be backported as far as
2.0.
(cherry picked from commit e763c8c99f7134a009117a59e6a6002b3c9e8c84)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/http_ana.c b/src/http_ana.c
index 1e144c7..9c7d2f5 100644
--- a/src/http_ana.c
+++ b/src/http_ana.c
@@ -1421,8 +1421,13 @@
if (si->conn_retries < 0)
return -1;
- if (objt_server(s->target))
+ if (objt_server(s->target)) {
+ if (s->flags & SF_CURR_SESS) {
+ s->flags &= ~SF_CURR_SESS;
+ _HA_ATOMIC_SUB(&__objt_server(s->target)->cur_sess, 1);
+ }
_HA_ATOMIC_ADD(&__objt_server(s->target)->counters.retries, 1);
+ }
_HA_ATOMIC_ADD(&s->be->be_counters.retries, 1);
req = &s->req;