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 28B536EC5B; Fri, 14 May 2021 14:02:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 28B536EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1620990152; bh=zXB9w/hO0JyxZlIlC0RHXhlMfHJ6RNENJ598vqsEBX4=; 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=OVfy/QNmFpSmrqmpYjV3A2/FuaPjzsPbu+udPDlSypH7ci03KkaP2GAgntkG8FFs7 l2qoGAZmdmUHOAJmP3Vk2w1jqvRj5PvQLaokngYXK7nuXMcdkVst+VPsApvpEoUvYl 9U3AX6NH+4XY7V8U4aACcmb3qRrYDST4n4J9Gw68= 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 6A2886EC5B for ; Fri, 14 May 2021 14:02:30 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6A2886EC5B Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1lhVaP-0003zp-AV; Fri, 14 May 2021 14:02:29 +0300 Date: Fri, 14 May 2021 13:41:15 +0300 To: Cyrill Gorcunov Cc: tml , Vladislav Shpilevoy Message-ID: <20210514104115.GI3944@tarantool.org> References: <20210514101947.106581-1-gorcunov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.10.1 (2018-07-13) X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD95978C26455E69BE0FB16CA32063744B94D060C3A2F6991A4182A05F5380850400DAFE029E542579014155931D59566C497242B20016A30E0C9B6A7A4D81BB457 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE735102D6D0BF494F7EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F1F2DD05CDE7D3F9EA1F7E6F0F101C67CDEEF6D7F21E0D1D9295C2E9FA3191EE1B59CA4C82EFA65878A2A9A3B45034A11E2C37F636F0454DF6B57BC7E64490618DEB871D839B73339E8FC8737B5C224901F8F2FECC0250C8CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C0E8801E8C4F941C018941B15DA834481F9449624AB7ADAF372E808ACE2090B5E14AD6D5ED66289B5259CC434672EE63711DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C37725542EFDE5E0D335872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-C1DE0DAB: 0D63561A33F958A55F966F8B7B4EB5DDE0291F543C53F94C762735088CDC7BDBD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA75438CC92D4039F4E2410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A783A638E01A3CDEDA23BCC5C7893E100F59741F1A353F4A3225A9AC442FDD60353FCB14F167A6CA1D7E09C32AA3244C2902FDBCA39AACFFBBAAC136855E202BF2F5F14F68F1805B927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojoybArHp+PQV92kn3eQdWlw== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638224C39C4D59262E393758BB260C18C577BA7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: Re: [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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 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. > > 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); 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. > + 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 > [1]: https://github.com/tarantool/tarantool/commit/b990d36 [2]: https://www.lua.org/manual/5.1/manual.html#lua_pushfstring -- Best regards, IM