From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 88CA9446439 for ; Sat, 26 Sep 2020 00:29:17 +0300 (MSK) From: Vladislav Shpilevoy Date: Fri, 25 Sep 2020 23:29:12 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 2/3] [tosquash] raft: fix 99% CPU issue in raft io worker List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, sergepetrenko@tarantool.org The idle flag was never set to true after being set to false. So the fiber infinitely called fiber_sleep(0) when didn't have anything else to do. --- src/box/raft.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/box/raft.c b/src/box/raft.c index 9ef03d8c4..8e5f7803c 100644 --- a/src/box/raft.c +++ b/src/box/raft.c @@ -631,8 +631,9 @@ static int raft_worker_f(va_list args) { (void)args; - bool is_idle = true; + bool is_idle; while (!fiber_is_cancelled()) { + is_idle = true; if (raft.is_write_in_progress) { raft_worker_handle_io(); is_idle = false; -- 2.21.1 (Apple Git-122.3)