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 43E5D6C1AE; Mon, 17 May 2021 10:58:00 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 43E5D6C1AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1621238280; bh=dCEp9TYl4+M124e5kHcdFbDZx6Woz5iXLS6Ek4qK4rU=; 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=PIaJRMjhTicYg+KyYemojv/BCQFid+EgWkUXDdSsbmDEeU4NT7hXgzN9XeID3+xB8 TejAOuWza0te8QbRjCBDap0Lmw8Ijd2HUvS+InCEZh3kOUTZCmjwA0e7aPUXnBXNoT UvFwWmUTZFnN6wBawxRozDW9oD0yFEjcQ6zZ2A+Q= Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 D33376C1AE for ; Mon, 17 May 2021 10:57:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D33376C1AE Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1liY8T-0000az-MZ; Mon, 17 May 2021 10:57:58 +0300 Date: Mon, 17 May 2021 10:36:42 +0300 To: Cyrill Gorcunov Cc: tml , Vladislav Shpilevoy Message-ID: <20210517073642.GK3944@tarantool.org> References: <20210514101947.106581-1-gorcunov@gmail.com> <20210514104115.GI3944@tarantool.org> 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: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD95978C26455E69BE022900C3053DBED76BEB47C8A8E1FDA50182A05F538085040C1FF9CBAB338A567D1C5DB33F872597E9A055FE07B3C3B68AE8B09B432DD4DD3 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE79EDB57D1FB735487EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F790063745B6F93C788775E78638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D889BA8DA3F358B790188FBBB87236316C117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC55B19328CBC4F849A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F4460429728776938767073520B1593CA6EC85F86DE5D25F19253116ADD2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B69DC5D3EDC80DC730089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: 0D63561A33F958A54F3B361366B53467A87CA1711E6D3DE50A2D69993834EEDAD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA752546FE575EB473F1410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34F38194B2C99DC128618788A1BE15F5262616398AF92B34DE947099C229B3AA7FEACA4B4C178D42BF1D7E09C32AA3244C078001F27388716A1E907CC3EFA4295163871F383B54D9B3927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojlIWKWc0dtJ04ZLP/istwLA== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638227B3BA98DD4F719E5EA505D78953BB5DDA7C8D0F45F857DBFE9F1EFEE2F478337FB559BB5D741EB964C8C2C849690F8E70A04DAD6CC59E33667EA787935ED9F1B 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: Igor Munkin via Tarantool-patches Reply-To: Igor Munkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Cyrill, On 14.05.21, Cyrill Gorcunov 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. Fun fact: I see no words regarding this in our contribution guide, so I have no answer for you, only examples. > > > 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". I see now, thanks for clarification! > > Force pushed an update. Now LGTM, thanks. > --- > 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 > -- Best regards, IM