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 21BCB6C1AE; Mon, 17 May 2021 11:22:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 21BCB6C1AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1621239764; bh=iwk9BP5HiUSxnngNS10AyYKK7fYrDUr/hQLLQ9b3F24=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=r35fxrAKJoAsZ1zl/JrMmWBXtbcmMVydIBF3WSff5fb5z4t4KkpJDjdugO9h2SkO2 bfYnZq86aGFo/2zRaKuh3SuSEB+ZdawodoMqr9auB0/ZJK6PEbtxEObNGJEGOaAUNL k6sg/JT+mJcGZfvnA3AWdiwsWRZvoseqiFFLtwIM= Received: from smtp33.i.mail.ru (smtp33.i.mail.ru [94.100.177.93]) (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 7AE956C1AE for ; Mon, 17 May 2021 11:22:42 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7AE956C1AE Received: by smtp33.i.mail.ru with esmtpa (envelope-from ) id 1liYWQ-0003WX-09; Mon, 17 May 2021 11:22:42 +0300 Date: Mon, 17 May 2021 11:22:40 +0300 To: Cyrill Gorcunov Cc: tarantool-patches@dev.tarantool.org Message-ID: <20210517082240.GA574844@hpalx> References: <20210514101947.106581-1-gorcunov@gmail.com> <20210514104115.GI3944@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-7564579A: 78E4E2B564C1792B X-77F55803: 4F1203BC0FB41BD95978C26455E69BE0890FB394E039F71AA2C815CBBA0C08E7182A05F53808504086CB1167EC40CAA7056CB31424231364F8F567E4C04F11C21AFB585F5C807D6A X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77C1346FE4B18DC51EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006371AA4FDB8B3812E678638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2395716C5E5DF16DEE5BFF8F81D2A64AFE5D25F19253116ADD2E47CDBA5A96583C09775C1D3CA48CF53FA85A707D24CADCC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C03257DF78C985F6198941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD2691661749BA6B97735E72BA08CD36276B67B076A6E789B0E97A8DF7F3B2552694A1E7802607F20496D49FD398EE364050FC24E1E72F37C03A003CEA74F0D118906B3661434B16C20AC78D18283394535A9E827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B0A3D6E0C1D2C8CCB75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A24209795067102C07E8F7B195E1C97831293F1977EE0E90AD778C2F04FB368B36 X-C1DE0DAB: 0D63561A33F958A562742F33B60E0EF3A6566F8D5FEFD33FA53390CE9D0F853BD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA752546FE575EB473F1410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34F38194B2C99DC128C5C83C3FC6BDE205E7165059C006C5F8D31584063B13539FDD0D04AC9717D6F81D7E09C32AA3244CE7323D844B892C95541C5ABCEDAC859B5595C85A795C7BAE729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojlIWKWc0dtJ1qu9SWklCTSA== X-Mailru-Sender: 11C2EC085EDE56FA610F8FEA03B6976B74A86771C68C34019BAB8E380C6C07BB94E9A093BA7D1E92C6BE15A09D9B9DC7F25921C611F62F88B76B9718D0A84D677D8D5F77027693F59437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v3] 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: "Alexander V. Tikhonov via Tarantool-patches" Reply-To: "Alexander V. Tikhonov" Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi Cyrill, thanks for the patch, it LGTM. On Fri, May 14, 2021 at 03:15:14PM +0300, Cyrill Gorcunov via Tarantool-patches wrote: > On Fri, May 14, 2021 at 01:41:15PM +0300, Igor Munkin wrote: > > Cyrill, > > > > Thanks for the fixes! Just a couple of nits. > > > > On 14.05.21, Cyrill Gorcunov via Tarantool-patches wrote: > > > This fixes a nit in commit 6af473778 > > > (fiber: use uint64_t for fiber IDs). > > > > If you want to mention this commit, please use the full hash and enclose > > I don't understand why you need a full hash? When the reference is generated > the git makes sure that id being generated is long enough among existing > commits to be parseble. But sure, no problem. > > > the commit subject into single quotes: it's the common way used in repo. > > You can find an example here[1] (but GitHub strips the hash while > > rendering the webpage). > > > > > > > > Since lua_pushfstring doesn't support %llu format it > > > breaks the test > > > > Minor: It would be nice to refer Lua Reference Manual[2] then. > > Sure, thanks! > > > > + 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); > > > > Why do you cast the value to long long (i.e. signed value), but use the > > unsigned %llu modifier? This might be OK, but it's not clear to me. > > Because only _size_ of argument does matter, and language standart > guarantees that signed and unsigned arguments are counterparts. Thus > instead of big "unsigned long long" specificator you can write a > shorthand "long long". > > Force pushed an update. > --- > From: Cyrill Gorcunov > Date: Fri, 14 May 2021 13:18:13 +0300 > > This fixes a nit in commit 6af4737789042b1e6673c421686bb4394a61f4a1 > ("fiber: use uint64_t for fiber IDs"). > > Since lua_pushfstring doesn't support %llu format [1] it > breaks the test > > app-tap/gh-1700-abort-recording-on-fiber-switch.test.lua > > [1] https://www.lua.org/manual/5.1/manual.html#lua_pushfstring > > Signed-off-by: Cyrill Gorcunov > --- > 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 >