querier_cache: unregister queriers evicted due to expired TTL
Currently queriers evicted due to their TTL expiring are not unregistered from the `reader_concurrency_semaphore`. This can cause a use-after-free when the semaphore tries to evict the same querier at some later point in time, as the querier entry it has a pointer to is now invalid. Fix by unregistering the querier from the semaphore before destroying the entry. Refs: #4018 Refs: #4031 Signed-off-by: Botond Dénes <bdenes@scylladb.com> Message-Id: <4adfd09f5af8a12d73c29d59407a789324cd3d01.1546504034.git.bdenes@scylladb.com>
This commit is contained in:
@@ -191,6 +191,7 @@ void querier_cache::scan_cache_entries() {
|
||||
while (it != end && it->is_expired(now)) {
|
||||
++_stats.time_based_evictions;
|
||||
--_stats.population;
|
||||
_sem.unregister_inactive_read(it->get_inactive_handle());
|
||||
it = _entries.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user