From 395e41c593bc746b426bbe213554d313bdc91f11 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 14 Sep 2018 13:19:16 +0300 Subject: [PATCH] dict-client: Avoid excessive CPU usage while waiting commands to finish client_dict_add_timeout() adds the timeout thinking that the dict no longer has any work to do, so it can be freed soon. However, if other work is added before that, the timeout just keeps getting called over and over again. This is especially bad with the default idle timeout of 0. --- src/lib-dict/dict-client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib-dict/dict-client.c b/src/lib-dict/dict-client.c index f4d6d84b87..131cd6edeb 100644 --- a/src/lib-dict/dict-client.c +++ b/src/lib-dict/dict-client.c @@ -419,6 +419,8 @@ static void client_dict_timeout(struct client_dict *dict) { if (client_dict_is_finished(dict)) client_dict_disconnect(dict, "Idle disconnection"); + else + timeout_remove(&dict->to_idle); } static bool client_dict_have_nonbackground_cmds(struct client_dict *dict) -- 2.47.3