From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 9032D70202; Wed, 24 Feb 2021 18:37:04 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9032D70202 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1614181024; bh=cSkzLh/QoajYXXYwUuZfGdIwCFacw/4cxfImWyrcJyY=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=feAC1hIkA37q7yP30ko1hXO18i32Mqv01Cy863VIZAWUtrWXEgn/Ze22R0Mv+oQQN SwrdmhsWsMVitHqoXni0gk8Uit8OGICKPQ7Lobg3nXHFctzyuPJBQo0GCNV5cPQ+IM ua2pBb0jsGMfNJTje1Wex7YgM01XzaZLXS0/sOl4= Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 102AD70202 for ; Wed, 24 Feb 2021 18:36:43 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 102AD70202 Received: by mail-lf1-f46.google.com with SMTP id w36so3677034lfu.4 for ; Wed, 24 Feb 2021 07:36:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f1PeUWWvugadICfdlniL+ZaJezUaNBAESB5ESmit5W0=; b=hqj6fYtQIEHCpz1Tsg/NWbvKcz4feGiNHuQKLvK++xHQfRUu9QMA+q+6HS7Tgt8Fry d1T08l+BZAGSBZfe3AhWKQs11J7F/RnF1alQmtRtX6yrVzlf0xzvsRDOSPdEhqmxY/3V HkPcUFA8h5T8JpOlep3w30XUOSSXNUqgqxDCNEQjaG7vf+QAe8hND1KJAIHcUvBIEUzT Ii7OgrVBdQWytdZUQYkXELb+kc45iRPxMXhHloOZ8OFcVWuzImdK+7XNm/AFplZldqC5 dX7iHV+vhZMLFEFo199CO6lKIQGsK1sEDKD6dYss+EoGUFJmwP3oYTJ/Wvdg+mAC6FY4 KHow== X-Gm-Message-State: AOAM531mkLMtlnqsrnEhMal2x12Spj0itSo/KPRVkia4fxldP0gNaT0E LL3ByvXurBKzeDd7oR98zQtj8KA1iWk+0g== X-Google-Smtp-Source: ABdhPJxjJ7X71XhCHt2le7t+C/8NCroCi+PcuKshXkwcQNc2RDq/C2czmUPu4xotouMT+Mal8+P0tA== X-Received: by 2002:a05:6512:b06:: with SMTP id w6mr19142334lfu.190.1614181001965; Wed, 24 Feb 2021 07:36:41 -0800 (PST) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id c16sm541783lfb.302.2021.02.24.07.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 07:36:40 -0800 (PST) Received: by grain.localdomain (Postfix, from userid 1000) id C7544560077; Wed, 24 Feb 2021 18:36:28 +0300 (MSK) To: tml Date: Wed, 24 Feb 2021 18:36:17 +0300 Message-Id: <20210224153626.121506-2-gorcunov@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210224153626.121506-1-gorcunov@gmail.com> References: <20210222182030.76232-1-gorcunov@gmail.com> <20210224153626.121506-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v2 01/10] say: use unsigned format for fiber()->fid X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" The fiber's ID (fiber::fid) is defined as unsigned integer so we should use a proper format specificator when printing it out. Currently logger prints such fibers as negative | main/-244760339/cartridge.failover.task I> Instance state changed why it should be | main/4271292179/cartridge.failover.task I> Instance state changed After the fix all fibers are logged with natural numbers (both in plain logger and json output formats). Fixes #5846 Signed-off-by: Cyrill Gorcunov --- changelogs/unreleased/fix-fiber-fid-log.md | 5 +++++ src/lib/core/say.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/fix-fiber-fid-log.md diff --git a/changelogs/unreleased/fix-fiber-fid-log.md b/changelogs/unreleased/fix-fiber-fid-log.md new file mode 100644 index 000000000..fb75af804 --- /dev/null +++ b/changelogs/unreleased/fix-fiber-fid-log.md @@ -0,0 +1,5 @@ +## bugfix/core + +* Fix logger output for fiber id: format specificator has been + using signed integers while fibers actually are defined as + unsigned numbers (gh-5846). diff --git a/src/lib/core/say.c b/src/lib/core/say.c index cbd10e107..76c524872 100644 --- a/src/lib/core/say.c +++ b/src/lib/core/say.c @@ -792,8 +792,8 @@ say_format_plain_tail(char *buf, int len, int level, const char *filename, if (cord) { SNPRINT(total, snprintf, buf, len, " %s", cord->name); if (fiber() && fiber()->fid != FIBER_ID_SCHED) { - SNPRINT(total, snprintf, buf, len, "/%i/%s", - fiber()->fid, fiber_name(fiber())); + SNPRINT(total, snprintf, buf, len, "/%u/%s", + (unsigned)fiber()->fid, fiber_name(fiber())); } } @@ -918,7 +918,7 @@ say_format_json(struct log *log, char *buf, int len, int level, const char *file SNPRINT(total, snprintf, buf, len, "\""); if (fiber() && fiber()->fid != FIBER_ID_SCHED) { SNPRINT(total, snprintf, buf, len, - ", \"fiber_id\": %i, ", fiber()->fid); + ", \"fiber_id\": %u, ", (unsigned)fiber()->fid); SNPRINT(total, snprintf, buf, len, "\"fiber_name\": \""); SNPRINT(total, json_escape, buf, len, -- 2.29.2