Skip to content

Commit 9e24f12

Browse files
committed
flow/manager: fix multi instance row tracking
In multi instance flow manager setups, each flow manager gets a slice of the hash table to manage. Due to a logic error in the chunked scanning of the hash slice, instances beyond the first would always rescan the same (first) subslice of their slice. The `pos` variable that is used to keep the state of what the starting position for the next scan was supposed to be, was treated as if it held a relative value. Relative to the bounds of the slice. It was however, holding an absolute position. This meant that when doing it's bounds check it was always considered out of bounds. This would reset the sub- slice to be scanned to the first part of the instances slice. This patch addresses the issue by correctly handling the fact that the value is absolute. Bug: #7365. Fixes: e9d2417 ("flow/manager: adaptive hash eviction timing") (cherry picked from commit ae072d5)
1 parent 206daee commit 9e24f12

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/flow-manager.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ static uint32_t FlowTimeoutHash(FlowManagerTimeoutThread *td, SCTime_t ts, const
506506
* \param hash_max upper bound of the row slice
507507
* \param counters Flow timeout counters to be passed
508508
* \param rows number of rows for this worker unit
509-
* \param pos position of the beginning of row slice in the hash table
509+
* \param pos absolute position of the beginning of row slice in the hash table
510510
*
511511
* \retval number of successfully timed out flows
512512
*/
@@ -520,7 +520,7 @@ static uint32_t FlowTimeoutHashInChunks(FlowManagerTimeoutThread *td, SCTime_t t
520520
uint32_t rows_left = rows;
521521

522522
again:
523-
start = hash_min + (*pos);
523+
start = (*pos);
524524
if (start >= hash_max) {
525525
start = hash_min;
526526
}
@@ -800,7 +800,7 @@ static TmEcode FlowManager(ThreadVars *th_v, void *thread_data)
800800

801801
uint32_t emerg_over_cnt = 0;
802802
uint64_t next_run_ms = 0;
803-
uint32_t pos = 0;
803+
uint32_t pos = ftd->min;
804804
uint32_t rows_sec = 0;
805805
uint32_t rows_per_wu = 0;
806806
uint64_t sleep_per_wu = 0;

0 commit comments

Comments
 (0)