From: Victor Julien Date: Mon, 29 May 2023 06:42:46 +0000 (+0200) Subject: flow/worker: don't double count flow.wrk.flows_evicted X-Git-Tag: suricata-7.0.0-rc2~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=afbd4162f289e195aed8713de2638953ca86fda5;p=thirdparty%2Fsuricata.git flow/worker: don't double count flow.wrk.flows_evicted Since the queue isn't fully processed every run, double counting could happen. Fix by only counting actually processed flows from the queue. --- diff --git a/src/flow-worker.c b/src/flow-worker.c index 67d690aeba..adeaa6a53e 100644 --- a/src/flow-worker.c +++ b/src/flow-worker.c @@ -223,6 +223,8 @@ static void CheckWorkQueue(ThreadVars *tv, FlowWorkerThreadData *fw, FlowTimeout if (ret_queue.len > 0) { FlowSparePoolReturnFlows(&ret_queue); } + + StatsAddUI64(tv, fw->cnt.flows_removed, (uint64_t)i); } /** \brief handle flow for packet @@ -500,8 +502,6 @@ static inline void FlowWorkerProcessLocalFlows(ThreadVars *tv, FlowWorkerThreadD FLOWWORKER_PROFILING_START(p, PROFILE_FLOWWORKER_FLOW_EVICTED); if (fw->fls.work_queue.len) { - StatsAddUI64(tv, fw->cnt.flows_removed, (uint64_t)fw->fls.work_queue.len); - FlowTimeoutCounters counters = { 0, 0, }; CheckWorkQueue(tv, fw, &counters, &fw->fls.work_queue, max_work); UpdateCounters(tv, fw, &counters);