aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/redis_pool.cxx
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-05-25 14:41:30 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-05-25 14:41:30 +0100
commit95070f959420a871dff813669f809c345993e5e9 (patch)
tree87259c4fabcec99ab9c4580126d6e3f08a685083 /src/libserver/redis_pool.cxx
parent9a6924f90aaeb6f693c83257c04208216a138ef7 (diff)
downloadrspamd-95070f959420a871dff813669f809c345993e5e9.tar.gz
rspamd-95070f959420a871dff813669f809c345993e5e9.zip
[Fix] Fix an old issue with order of destruction race between redis pool and lua
Diffstat (limited to 'src/libserver/redis_pool.cxx')
-rw-r--r--src/libserver/redis_pool.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libserver/redis_pool.cxx b/src/libserver/redis_pool.cxx
index 19acaa828..0bbfa55de 100644
--- a/src/libserver/redis_pool.cxx
+++ b/src/libserver/redis_pool.cxx
@@ -244,13 +244,13 @@ public:
conns_by_ctx.emplace(ctx, conn);
}
- ~redis_pool() {
- /*
- * XXX: this will prevent hiredis to unregister connections that
- * are already destroyed during redisAsyncFree...
- */
+ /* Hack to prevent Redis callbacks to be executed */
+ auto prepare_to_die() -> void
+ {
wanna_die = true;
}
+
+ ~redis_pool() {}
};
@@ -612,6 +612,7 @@ rspamd_redis_pool_destroy(void *p)
{
auto *pool = reinterpret_cast<class rspamd::redis_pool *>(p);
+ pool->prepare_to_die();
delete pool;
}