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 4203A7744FE; Mon, 10 Feb 2025 17:53:27 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4203A7744FE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1739199207; bh=UEIFiaTF7zaREEV0wwbogMk8+cEzh/I+gxLkLTtm4eg=; 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=dM8NwlWK8vhjFO26WETu3qbW6XhKyjgpxt7SR/2rvpVIGs6rSDBl5pUxk6gd3169F f9mDMsqfI+rnptV6Xn3LBQNGvdOYIzZR0K/p+PHcke4kN6+mCLV33dbrBjo71kfDhN HOvTVZRRoxiRRe5aZ5B0QHAs9sybDlAd87WtRLwY= Received: from send81.i.mail.ru (send81.i.mail.ru [89.221.237.176]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 885C07744FE for ; Mon, 10 Feb 2025 17:53:07 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 885C07744FE Received: by exim-smtp-5c664d6544-lfmj4 with esmtpa (envelope-from ) id 1thV9m-000000001Yn-2fup; Mon, 10 Feb 2025 17:53:07 +0300 Date: Mon, 10 Feb 2025 17:52:20 +0300 To: Sergey Bronnikov Cc: tarantool-patches@dev.tarantool.org Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD980EDB4062763125E34B82A4156303A69C8E399BB4D90227200894C459B0CD1B9191420DD958885109487ABAC94A94B54C871E330AFDEB890A2623FF0697791C316B550D20AEFFB87 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE75263010198C72082EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637CDE631A26C8A2C128638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8ED4D2B54CE723656ED1367A04496D47031B6F0166D0C45D8CC7F00164DA146DAFE8445B8C89999728AA50765F7900637F6B57BC7E64490618DEB871D839B7333395957E7521B51C2DFABB839C843B9C08941B15DA834481F8AA50765F7900637CAEE156C82D3D7D9389733CBF5DBD5E9B5C8C57E37DE458BD9DD9810294C998ED8FC6C240DEA76428AA50765F7900637EDA40AC3E23A7648D32BA5DBAC0009BE395957E7521B51C2330BD67F2E7D9AF1090A508E0FED6299176DF2183F8FC7C03D5BA627BF9F2FCFB3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BAEB924C2B054B06E75ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A502DCF6C90D7348295002B1117B3ED69630C4AC7C7225C8168D59E407A97E9958823CB91A9FED034534781492E4B8EEADA3A806F356AF31D6 X-C8649E89: 1C3962B70DF3F0ADBF74143AD284FC7177DD89D51EBB7742424CF958EAFF5D571004E42C50DC4CA955A7F0CF078B5EC49A30900B95165D34D8C933888226C841DFE2888356D8F89FE2C47CE51DBC704A228AF135FCD15BB78654BE71F4A00C4B1D7E09C32AA3244CEDA11C56B5CA524277DD89D51EBB77421D99A6B32A26958DEA455F16B58544A2E30DDF7C44BCB90DA5AE236DF995FB59829709634694AABAED6A17656DB59BCAD427812AF56FC65B X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojy7TIew8PonH3T+VQ5DxgxA== X-Mailru-Sender: 520A125C2F17F0B1A9638AD358559B5969E4F45FB7C64B583DE06ABAFEAF6705E00D8BD6399B8277B7CBEF92542CD7C88B0A2698F12F5C9EC77752E0C033A69E86920BD37369036789A8C6A0E60D2BB63A5DB60FBEB33A8A0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 4/4] sysprof: fix a message with stop without run 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: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Sergey! Thanks for the patch! Please consider my comments below. On 04.02.25, Sergey Bronnikov wrote: > The function `misc.sysprof.stop()` reports that profiler is > already running: > > | $ ./build/src/luajit -e 'print(misc.sysprof.stop())' Minor: You may omit a ./build here, but this is a matter of taste, so feel free to ignore. > | nil profiler is running already 22 > > The patch fixes that. Unfortunatelly not: | $ git --no-pager log --oneline -n1 --no-decorate && ./src/luajit -e 'print(misc.sysprof.stop())' | b49c5fac sysprof: fix a message with stop without run | nil profiler is running already 22 See my comments below. Please add the follow-up to the tarantool/tarantool#781. > --- > src/lj_sysprof.c | 2 +- > test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua | 5 +++-- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/src/lj_sysprof.c b/src/lj_sysprof.c > index 88c7a41b..b76f503c 100644 > --- a/src/lj_sysprof.c > +++ b/src/lj_sysprof.c > @@ -493,7 +493,7 @@ int lj_sysprof_stop(lua_State *L) > global_State *g = sp->g; > struct lj_wbuf *out = &sp->out; > > - if (SPS_IDLE == sp->state) > + if (SPS_PROFILE != sp->state) This check is correct. It checks that the profiler has no error or is not running (i.e., that it is stopped). With the new check, a case with an error during profiling will be masked. It looks like we should add this case in the `misc.sysprof.stop()` (it uses `sysprof_error()` which handles start cases). > return PROFILE_ERRRUN; > else if (G(L) != g) > return PROFILE_ERRUSE; > diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua > index 68a4b72f..91f9ca5c 100644 > --- a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua > +++ b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua > @@ -10,7 +10,7 @@ local test = tap.test("misc-sysprof-lapi"):skipcond({ > ["Disabled due to #10803"] = os.getenv("LUAJIT_TEST_USE_VALGRIND"), > }) > > -test:plan(33) > +test:plan(34) > > jit.off() > -- XXX: Run JIT tuning functions in a safe frame to avoid errors > @@ -98,7 +98,8 @@ assert(res, err) > > -- Not running. > res, err, errno = misc.sysprof.stop() > -test:ok(res == nil and err, "res and error with not running") > +test:is(res, nil, "res with not running") > +test:ok(err:match("profiler is running already"), "error with not running") I suppose there is bad copy-pasting here. It should be: 'profiler is not running'. This is why the test passes. > test:ok(type(errno) == "number", "errno with not running") > > -- Bad path. > -- > 2.34.1 > -- Best regards, Sergey Kaplun