]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dict-client: Avoid excessive CPU usage while waiting commands to finish
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 14 Sep 2018 10:19:16 +0000 (13:19 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 13 Nov 2018 11:51:29 +0000 (13:51 +0200)
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

index f4d6d84b871b357c01d0f754a8bb550e3291d1fd..131cd6edeb664c5d13a5b7935c6e157b961e4a5b 100644 (file)
@@ -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)