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 6BAC46EC5B; Fri, 14 May 2021 13:32:55 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6BAC46EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1620988375; bh=k9O0wL4eGAuE3h8mAEeda7d5AYr+hBcRQjyBSeoDnlI=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=UTHVaRcSELOV9xJplXejKSEb21RdkNJ0HkeLkIFado7JSD0jWyreW1X4eDXPVErkj Li/Jh2jpJNjTnHj6IX+SvXfD5O6FAV+7yRZkx7VJyHVuUxHXQuFF8LCKpbP1SmHPFJ O+GjVlXyT6dYYNZLweONd6W533RBFpamwPjOjY7c= Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 3332F6EC5B for ; Fri, 14 May 2021 13:32:54 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3332F6EC5B Received: by mail-lj1-f179.google.com with SMTP id v5so37280028ljg.12 for ; Fri, 14 May 2021 03:32:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=4Y0DxT3vWTKc/vAr92yOmcMK3F7VdFa5CbJ9+4QMS5E=; b=MURuDjIVOfA3LeLYHITZsEh7HQIXOu/KdpN1i6uoIZW/x/dxcSQJiu29hSQ25lXUeR YPAl2Ic+YL5+pi1evjeNR7O+Qeskc81ZDB+Ex78iUyNSwWQPG0N/QfaSHIriRHB0/9gy l5g35eBgtq4Df8OxC4/N2lGlh0Djabkc/KwtGzf5MNLewnyr0j25RndwOiGgfuvSaU38 5PjcuWTz4iWsNvJnQQQYkVqAKxK3vGKyImNk6mKIzIziKXLVxp8ziO02AHA/P/EbcaLi 3qBHTciPsEyrbu+I1bMDqYRUk8nSu4AL4N0FP3zYYOaHxKbG5RlVhQiWHhWu09bxPn7c Swaw== X-Gm-Message-State: AOAM533z2eabPYFayTDyGHoVyRbpg0v0pPazl18whvp1bnBxsDKY38gR UQisbjNPxNjiesq2BtOkZyp7UA9SR9A= X-Google-Smtp-Source: ABdhPJw3EvJiakwQPo3aa2uVyPrKxxfy4YIb6ZaiEWXgfShdlWX3fai0aI9WUd4u76bqR5z7UEaxLQ== X-Received: by 2002:a2e:b0c2:: with SMTP id g2mr37133246ljl.492.1620988373034; Fri, 14 May 2021 03:32:53 -0700 (PDT) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id q27sm619224lfd.266.2021.05.14.03.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 May 2021 03:32:52 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 727E05A003D; Fri, 14 May 2021 13:32:51 +0300 (MSK) Date: Fri, 14 May 2021 13:32:51 +0300 To: tml Message-ID: References: <20210514101947.106581-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210514101947.106581-1-gorcunov@gmail.com> User-Agent: Mutt/2.0.6 (2021-03-06) Subject: [Tarantool-patches] [PATCH v2] lua/utils: fix fiber->fid print in cord_on_yield 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" This fixes a nit in commit 6af473778 (fiber: use uint64_t for fiber IDs). Since lua_pushfstring doesn't support %llu format it breaks the test app-tap/gh-1700-abort-recording-on-fiber-switch.test.lua Signed-off-by: Cyrill Gorcunov --- branch gorcunov/gh-5846-fid-name-fix src/lua/utils.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/lua/utils.c b/src/lua/utils.c index 0fbe700fc..3ce821374 100644 --- a/src/lua/utils.c +++ b/src/lua/utils.c @@ -1341,6 +1341,7 @@ void cord_on_yield(void) * code misbehaviour and failures, so stop its execution. */ if (unlikely(tvref(g->jit_base))) { + char buf[256]; /* * XXX: mcode is executed only in scope of Lua * world and one can obtain the corresponding Lua @@ -1348,10 +1349,12 @@ void cord_on_yield(void) */ struct lua_State *L = fiber()->storage.lua.stack; assert(L != NULL); - lua_pushfstring(L, "fiber %llu is switched while running the" - " compiled code (it's likely a function with" - " a yield underneath called via LuaJIT FFI)", - (long long)fiber()->fid); + snprintf(buf, sizeof(buf), + "fiber %llu is switched while running the" + " compiled code (it's likely a function with" + " a yield underneath called via LuaJIT FFI)", + (long long)fiber()->fid); + lua_pushstring(L, buf); if (g->panic) g->panic(L); exit(EXIT_FAILURE); @@ -1376,11 +1379,14 @@ void cord_on_yield(void) * GC hook is active and the platform is forced to stop. */ if (unlikely(g->hookmask & HOOK_GC)) { + char buf[128]; struct lua_State *L = fiber()->storage.lua.stack; assert(L != NULL); - lua_pushfstring(L, "fiber %d is switched while running GC" - " finalizer (i.e. __gc metamethod)", - fiber()->fid); + snprintf(buf, sizeof(buf), + "fiber %llu is switched while running GC" + " finalizer (i.e. __gc metamethod)", + (long long)fiber()->fid); + lua_pushstring(L, buf); if (g->panic) g->panic(L); exit(EXIT_FAILURE); -- 2.31.1