mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-23 06:41:32 +02:00
BUG/MINOR: stats: Prevent HTTP "other sessions" counter underflows
Due to multithreading concurrency, it is difficult at this time to figure out how this counter may become negative. This simple patch only checks this will never be the case. This issue arrives with this commit: "9969adbcdc MINOR: stats: add by HTTP version cumulated number of sessions and requests" So, this patch should be backported when the latter has been backported.
This commit is contained in:
parent
b7a406ac34
commit
d97d1d7c7c
@ -1876,6 +1876,7 @@ int stats_fill_fe_stats(struct proxy *px, struct field *stats, int len,
|
||||
total_sess = px->fe_counters.cum_sess;
|
||||
for (i = 0; i < nb_sess; i++)
|
||||
total_sess -= px->fe_counters.cum_sess_ver[i];
|
||||
total_sess = (int64_t)total_sess < 0 ? 0 : total_sess;
|
||||
metric = mkf_u64(FN_COUNTER, total_sess);
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user