From 156271ef9fb4c95de80ca9a8dd8ebddad1ff7c0d Mon Sep 17 00:00:00 2001 From: Stefan Mititelu Date: Wed, 12 May 2021 18:08:25 +0300 Subject: [PATCH] Avoid deadlock of notification thread Fixes issue #1258. --- daemon/redis.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/daemon/redis.c b/daemon/redis.c index acce83ae5..6df9ddf02 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -378,7 +378,12 @@ void on_redis_notification(redisAsyncContext *actx, void *reply, void *privdata) goto err; } } + mutex_unlock(&r->lock); + + // unlock before restoring calls to avoid deadlock in case err happens json_restore_call(r, &callid, 1); + + mutex_lock(&r->lock); } if (strncmp(rr->element[3]->str,"del",3)==0) {