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 53F511287FC3; Tue, 11 Mar 2025 15:01:58 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 53F511287FC3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1741694518; bh=Ik2jZEi6nA4BrrP+bjyXZ4SDZH4aAhESjkMo0UMTAsc=; 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=J2ez8ViO5MNb9onC3yU12GK4UU0/mMX9yxtJ1P+WO9ZIOLNQjoB4Nk+Rxk/qAWbbq Qqi+TsZLevyXnGlI4U7zKeLWCAV+otOE4or67GjyloC5/PPIwTrde0oj46drRFu3fO jaq+1E296WQOXG/rAhG6S/b9OZdEXdqoRfRgHfrs= Received: from send172.i.mail.ru (send172.i.mail.ru [95.163.59.11]) (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 998A81287FC3 for ; Tue, 11 Mar 2025 15:01:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 998A81287FC3 Received: by exim-smtp-69cc44787d-tf558 with esmtpa (envelope-from ) id 1tryJ1-00000000KzQ-2jiK; Tue, 11 Mar 2025 15:01:55 +0300 Content-Type: multipart/alternative; boundary="------------9HBZCtpPA0xvvguAGMokDNYZ" Message-ID: <5760221d-71f0-4443-8b77-3da6bb412931@tarantool.org> Date: Tue, 11 Mar 2025 15:01:55 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org References: <9dbb7d455c1953fcab6a82944b073348c17e46ac.1741617766.git.skaplun@tarantool.org> In-Reply-To: <9dbb7d455c1953fcab6a82944b073348c17e46ac.1741617766.git.skaplun@tarantool.org> X-Mailru-Src: smtp X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD977B76FDA87AFA8B993550E3C62B6922CC005A954C4BFFF6B182A05F5380850404C228DA9ACA6FE27EC666A4167747B403DE06ABAFEAF670534FBB44CA2F31553364570FA4D14350F45196DB1478570EB X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7D3DF794D859AA4BFEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F88016AB904663428638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2047CEC313A53C4042E070BE324C7D3C4071DD1874CBEE1AAF6B57BC7E64490618DEB871D839B73339E8FC8737B5C2249A70DDFFB3186CBC5CC7F00164DA146DAFE8445B8C89999729449624AB7ADAF37F6B57BC7E64490611E7FA7ABCAF51C92176DF2183F8FC7C045A75973B56231AD8941B15DA834481F9449624AB7ADAF37BA3038C0950A5D3613377AFFFEAFD269176DF2183F8FC7C0B29F19AEE42111807B076A6E789B0E97A8DF7F3B2552694AD5FFEEA1DED7F25D49FD398EE364050F140C956E756FBB7AC43C4D2AE8146675B3661434B16C20ACC84D3B47A649675FE827F84554CEF5019E625A9149C048EE9ECD01F8117BC8BEE2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8BEBEE3B39F980227375ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A52710C7221BED24455002B1117B3ED696BC4135B99F4A7248AD0703CEB2EF9A27823CB91A9FED034534781492E4B8EEADC0A73878EBD0941BBDAD6C7F3747799A X-C8649E89: 1C3962B70DF3F0ADE00A9FD3E00BEEDF3FED46C3ACD6F73ED3581295AF09D3DF87807E0823442EA2ED31085941D9CD0AF7F820E7B07EA4CF6752DE56AFF6AA50202C620494DFD276B8AE7990DEC6049BA9222B27179E4DDF711F655CCE117FA3F13513DA892F5B9DB30EBA1B1C24FC43F8C42200E7CF6678C891C6C4C2C3E37F111DC66A97D0BFE2913E6812662D5F2AB9AF64DB4688768036DF5FE9C0001AF333F2C28C22F508233FCF178C6DD14203 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu53w8ahmwBjZKM/YPHZyZHvz5uv+WouB9+ObcCpyrx6l7KImUglyhkEat/+ysWwi0gdhEs0JGjl6ggRWTy1haxBpVdbIX1nthFXMZebaIdHP2ghjoIc/363UZI6Kf1ptIMVQiWK+2I7Y2svRbi3IGfDNQ= X-Mailru-Sender: C4F68CFF4024C8867DFDF7C7F25884582F8F164E194A28ECAA70CB78A12CDBB55DC666C80B09E24168465951836D522F645D15D82EE4B272BD6E4642A116CA93524AA66B5ACBE6721EF430B9A63E2A504198E0F3ECE9B5443453F38A29522196 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit 2/3] Restore state when recording __concat metamethod throws OOM. 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" This is a multi-part message in MIME format. --------------9HBZCtpPA0xvvguAGMokDNYZ Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Sergey, thanks for the patch! LGTM with a minor comment below. Sergey On 10.03.2025 17:51, Sergey Kaplun wrote: > diff --git a/test/tarantool-tests/lj-1298-oom-on-concat-recording.test.lua b/test/tarantool-tests/lj-1298-oom-on-concat-recording.test.lua > new file mode 100644 > index 00000000..961df798 > --- /dev/null > +++ b/test/tarantool-tests/lj-1298-oom-on-concat-recording.test.lua > @@ -0,0 +1,53 @@ > +local tap = require('tap') > + > +-- Test file to demonstrate unbalanced Lua stack after instruction > +-- recording due to throwing an OOM error at the moment of > +-- recording without restoring the Lua stack back. > +-- See also:https://github.com/LuaJIT/LuaJIT/issues/1298. > + > +local test = tap.test('lj-1298-oom-on-concat-recording'):skipcond({ > + ['Test requires JIT enabled'] = not jit.status(), > +}) > + > +local allocinject = require('allocinject') > + > +test:plan(2) > + > +jit.opt.start('hotloop=1') > + > +-- Allocation limit to return `NULL`. > +local ALLOC_LIMIT = 2048 > + > +local bigstr = string.rep('x', ALLOC_LIMIT) > +local __concat = function() > + return 'concated' s/concated/concatenated/ --------------9HBZCtpPA0xvvguAGMokDNYZ Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Hi, Sergey,

thanks for the patch! LGTM with a minor comment below.

Sergey

On 10.03.2025 17:51, Sergey Kaplun wrote:

<snipped>

diff --git a/test/tarantool-tests/lj-1298-oom-on-concat-recording.test.lua b/test/tarantool-tests/lj-1298-oom-on-concat-recording.test.lua
new file mode 100644
index 00000000..961df798
--- /dev/null
+++ b/test/tarantool-tests/lj-1298-oom-on-concat-recording.test.lua
@@ -0,0 +1,53 @@
+local tap = require('tap')
+
+-- Test file to demonstrate unbalanced Lua stack after instruction
+-- recording due to throwing an OOM error at the moment of
+-- recording without restoring the Lua stack back.
+-- See also: https://github.com/LuaJIT/LuaJIT/issues/1298.
+
+local test = tap.test('lj-1298-oom-on-concat-recording'):skipcond({
+  ['Test requires JIT enabled'] = not jit.status(),
+})
+
+local allocinject = require('allocinject')
+
+test:plan(2)
+
+jit.opt.start('hotloop=1')
+
+-- Allocation limit to return `NULL`.
+local ALLOC_LIMIT = 2048
+
+local bigstr = string.rep('x', ALLOC_LIMIT)
+local __concat = function()
+  return 'concated'
s/concated/concatenated/


<snipped>

--------------9HBZCtpPA0xvvguAGMokDNYZ--