aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-08 14:40:38 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-09-08 14:40:38 +0100
commit2996fbba0a369032f96c0d6689ae2b6b623065d4 (patch)
tree1ce898f14b3fc530a11ed7167f467e886203d6eb
parentd968214c74bb120c742955b506283a6938869605 (diff)
downloadrspamd-2996fbba0a369032f96c0d6689ae2b6b623065d4.tar.gz
rspamd-2996fbba0a369032f96c0d6689ae2b6b623065d4.zip
[Fix] Treat all errors in redis_pool as fatal errors for a connection
-rw-r--r--src/libserver/redis_pool.c2
-rw-r--r--src/lua/lua_redis.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/libserver/redis_pool.c b/src/libserver/redis_pool.c
index e84f2360e..dd5adf221 100644
--- a/src/libserver/redis_pool.c
+++ b/src/libserver/redis_pool.c
@@ -334,7 +334,7 @@ rspamd_redis_pool_release_connection (struct rspamd_redis_pool *pool,
if (conn != NULL) {
g_assert (conn->active);
- if (is_fatal || ctx->err == REDIS_ERR_IO || ctx->err == REDIS_ERR_EOF) {
+ if (is_fatal || ctx->err != REDIS_OK) {
/* We need to terminate connection forcefully */
msg_debug_rpool ("closed connection forcefully");
REF_RELEASE (conn);
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index 203def2d0..402190351 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -661,6 +661,8 @@ lua_redis_make_request (lua_State *L)
if (ud->ctx) {
msg_err_task_check ("cannot connect to redis: %s",
ud->ctx->errstr);
+ rspamd_redis_pool_release_connection (task->cfg->redis_pool,
+ ud->ctx, TRUE);
ud->ctx = NULL;
}
else {
@@ -701,7 +703,7 @@ lua_redis_make_request (lua_State *L)
else {
msg_info_task_check ("call to redis failed: %s", ud->ctx->errstr);
rspamd_redis_pool_release_connection (task->cfg->redis_pool,
- ud->ctx, FALSE);
+ ud->ctx, TRUE);
ud->ctx = NULL;
REDIS_RELEASE (ctx);
ret = FALSE;