stream/cache: Return sessions to correct pool

Issue: 5563

This commit fixes the release of TCP resources. The sessions were being
returned to the segment thread pool instead of the sessions pool.
This commit is contained in:
Jeff Lucovsky
2023-06-09 10:37:09 +02:00
committed by Victor Julien
parent 0d0c9ea07b
commit f8c9390ca3
+4 -4
View File
@@ -157,19 +157,19 @@ void StreamTcpThreadCacheCleanup(void)
/* sessions */
SCLogDebug("tcp_pool_cache.ssns_cache_idx %u", tcp_pool_cache.ssns_cache_idx);
for (uint32_t i = 0; i < tcp_pool_cache.ssns_cache_idx; i++) {
PoolThreadReturn(segment_thread_pool, tcp_pool_cache.ssns_cache[i]);
PoolThreadReturn(ssn_pool, tcp_pool_cache.ssns_cache[i]);
}
tcp_pool_cache.ssns_cache_idx = 0;
SCLogDebug("tcp_pool_cache.ssns_returns_idx %u", tcp_pool_cache.ssns_returns_idx);
if (tcp_pool_cache.ssns_returns_idx) {
PoolThreadId pool_id = tcp_pool_cache.ssns_returns[0]->pool_id;
PoolThreadLock(segment_thread_pool, pool_id);
PoolThreadLock(ssn_pool, pool_id);
for (uint32_t i = 0; i < tcp_pool_cache.ssns_returns_idx; i++) {
TcpSession *ret_ssn = tcp_pool_cache.ssns_returns[i];
PoolThreadReturnRaw(segment_thread_pool, pool_id, ret_ssn);
PoolThreadReturnRaw(ssn_pool, pool_id, ret_ssn);
}
PoolThreadUnlock(segment_thread_pool, pool_id);
PoolThreadUnlock(ssn_pool, pool_id);
tcp_pool_cache.ssns_returns_idx = 0;
}