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 5FB0F1218BCC; Tue, 25 Feb 2025 10:34:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5FB0F1218BCC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1740468884; bh=R2mBhxTHvxLzuLIkuL6O/I7j3YkVfPfmjCeUs+FUCtg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=kl4ADk8RQkKqhKz7JRgxFipHQv+M7XRkSPRdGXP+NdkAq8u3vMSvl5eUeWM8oiB0C 4L9Gi0CRNiQ6wxGda1A4N0N03C+cX9dpyrm0uq4Xrg/oSbvs2dZMKuFzqSbzFGFEXj s7AaiGInY7LcriSldbx2t9WpGztYXg2A3SVL4zxU= Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (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 D97F91218BCC for ; Tue, 25 Feb 2025 10:33:36 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D97F91218BCC Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-54298ec925bso7495566e87.3 for ; Mon, 24 Feb 2025 23:33:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740468816; x=1741073616; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pw0agy5S5APLJHrPalcLZsMaEXekKfLJRnKCwGOIhlA=; b=kFgfG8K5IDi4IqxtF3YIiOPJxk+fyrqpvwJBUDEG2KSLIuhBoAKoE+VprdUUeVS3oU uXx5ZA8SW7z/uSnpvE69SDQA19i8oTELhcoqFJgfWIxjMO5ztfBv/ZEkrG7JCTFnCE/o fhG+fw2FSWLzi44I4fmlBWng3cJA/aFFjNFP9zfBsP4OHPbRRoLNv2T9W8IS94Qrz1R4 5SHTIb4XkbgeIOFyWSXODIfv9tZSiC7+eA/g93W0DQvNikE+gLMDixrReIzArVj3GVFp puK/bbRf3kfMB64+BFZTJf26ASDqMjOkw/qbIyWy/0j1t5T+J2cRtsDaf2qBnBsuq7/5 ijDw== X-Gm-Message-State: AOJu0Yzp5GRCN3NChcAi+80c5dAaaExK4Ip/pQL2I9Jj7HhObAV+ZreT 0zY4W3Y8niyu9dLR8XwKKVUg4w+L40VZ4oYEv5I0U0j/SvOfo6ZtzGcylHSRvao= X-Gm-Gg: ASbGncus3lQ1eFtSddkILmcDmS0LVIO8f9fUuC42SaWLlx9acjoapKME/xtNcexqJhp 9GXpYRQ2WHxrG6sGpwDigTGJW9FUXtISMFOaYLW1SU/p5HaIpXtoAy9Gud6dI0HczcNJSwdisQJ J6srSAN1XTCCKwDYPl6vYmuP+57j3CY3/ER0wnjivWm2T1CX590p24v1iaQeKGsiQbR3Aa18D74 nI/IB7SN2hkdOfOhlqBxAJ23EZ7NoA/XP7uJgEXMBQI28wJgOU01N0/+ZD2Xk49eD6O9LT1Dp0T gg1merH0hb8CyaWYe5I= X-Google-Smtp-Source: AGHT+IESXOwIixUKYpGe2Kk49XqzfeQxixPFyeAbHCuA5k7Xxf7KVzzuH/1Yn+kpQ1JrKzsubKFpvQ== X-Received: by 2002:a05:6512:70:b0:548:794f:f9c1 with SMTP id 2adb3069b0e04-548794ffa25mr188994e87.2.1740468815832; Mon, 24 Feb 2025 23:33:35 -0800 (PST) Received: from localhost ([79.164.223.111]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-548514fa94bsm101211e87.249.2025.02.24.23.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 23:33:35 -0800 (PST) X-Google-Original-From: Sergey Bronnikov To: tarantool-patches@dev.tarantool.org, Sergey Kaplun Date: Tue, 25 Feb 2025 10:32:50 +0300 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit 3/3] 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 Bronnikov via Tarantool-patches Reply-To: Sergey Bronnikov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" The function `misc.sysprof.stop()` reports that profiler is already running: | $ ./src/luajit -e 'print(misc.sysprof.stop())' | nil profiler is running already 22 both in `sysprof_error()` and fixes aforementioned problem. Follows up tarantool/tarantool#781 --- src/lib_misc.c | 6 ++++++ .../tarantool-tests/profilers/misclib-sysprof-lapi.test.lua | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib_misc.c b/src/lib_misc.c index c4b40996..74888d20 100644 --- a/src/lib_misc.c +++ b/src/lib_misc.c @@ -335,6 +335,12 @@ LJLIB_CF(misc_sysprof_stop) return prof_error(L, PROFILE_ERRUSE, err_details); #else int status = luaM_sysprof_stop(L); + if (LJ_UNLIKELY(status == PROFILE_ERRRUN)) { + lua_pushnil(L); + lua_pushstring(L, err2msg(LJ_ERR_PROF_NOTRUNNING)); + lua_pushinteger(L, EINVAL); + return 3; + } if (LJ_UNLIKELY(status != PROFILE_SUCCESS)) return prof_error(L, status, NULL); diff --git a/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua b/test/tarantool-tests/profilers/misclib-sysprof-lapi.test.lua index ebd80cf6..770b5736 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("misclib-sysprof-lapi"):skipcond({ ["Disabled due to #10803"] = os.getenv("LUAJIT_TEST_USE_VALGRIND"), }) -test:plan(43) +test:plan(44) jit.off() -- XXX: Run JIT tuning functions in a safe frame to avoid errors @@ -124,7 +124,8 @@ assert(res, err) -- Not running. res, err, errno = misc.sysprof.stop() -test:ok(res == nil and err, "result status and error with not running") +test:is(res, nil, "result status with not running") +test:ok(err:match("profiler is not running"), "error with not running") test:ok(type(errno) == "number", "errno with not running") -- Bad path. -- 2.43.0