]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow/worker: don't double count flow.wrk.flows_evicted
authorVictor Julien <vjulien@oisf.net>
Mon, 29 May 2023 06:42:46 +0000 (08:42 +0200)
committerVictor Julien <vjulien@oisf.net>
Wed, 31 May 2023 05:58:19 +0000 (07:58 +0200)
Since the queue isn't fully processed every run, double counting
could happen.

Fix by only counting actually processed flows from the queue.

src/flow-worker.c

index 67d690aeba4b837ef4fbcd7701b3ed0757d69e95..adeaa6a53e683be73eee5000d87aca2cf303617b 100644 (file)
@@ -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);