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 5B88070CB3; Mon, 11 Oct 2021 18:30:11 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 5B88070CB3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1633966211; bh=nSUdkh1Blj1VwbcMckUtVShmCrruSc3QuKgb2GY78EQ=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=l85CLweRMTdktU6LlUT9a1YoB/4DZ96FwcXCpJawA6yBKBbBf6J3pQwo6qwQBNE47 knxc2hnsP4uFbYlnZz/AMGEl2Wz1aLtD1AWuDdyjSL8JFBux9GrbOcLRhZ04OMyjBd MW4amNK1k8cpyr9or/x4PCPbrPk+llKlKKGIU0HU= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [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 8D0C770CB2 for ; Mon, 11 Oct 2021 18:30:08 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8D0C770CB2 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mZxFf-0007sR-JV; Mon, 11 Oct 2021 18:30:08 +0300 Date: Mon, 11 Oct 2021 18:28:27 +0300 To: Maxim Kokryashkin Message-ID: References: <20210930114337.1575120-1-m.kokryashkin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210930114337.1575120-1-m.kokryashkin@tarantool.org> X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD922964B4BA091D9AC21EE7E555FD527A2650BF6F702E1B55E182A05F538085040C4232ECB1578D47709D9E425C71FDC1270B26269A155850EB5DE0B401F678632 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A3295C83650092F9EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D4360D888D8F9BE48638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8E5FE0A90181269B2DBAA0E624E727F9E117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8BAA867293B0326636D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B67393CE827C55B5F775ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-C1DE0DAB: 0D63561A33F958A5AE383C4FE341CF80281E2C42AE543874B9666A5E8E579077D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA759D2A03B9C34326B3410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34697E0FA301E28215670ECA7064695F82E7487C3F3343C921040CE2657C7C17384BAF9F3A0722F4F21D7E09C32AA3244C30432A04CE99B22A5689A4D4024A5AD8F2F5F14F68F1805B83B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioju/+AAevgYAWjUYI+GU1mKA== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5DF03BFC70808ADF15B7D634BC34E8B0B30FBE9A32752B8C9C2AA642CC12EC09F1FB559BB5D741EB962F61BD320559CF1EFD657A8799238ED567EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH luajit] test: adapt test checking reversed function 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 Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi, Maxim! Thanks for the patch! Please consider my comments below. On 30.09.21, Maxim Kokryashkin wrote: > The first fiber in Tarantool has only 512Kb of the stack which is not enough to > handle such a deep call chain. > The test is adapted to Tarantool by decreasing the string length. > > Closes tarantool/tarantool#5782 > Part of tarantool/tarantool#5845 > Part of tarantool/tarantool#4473 Looks like it should be 5870 instead 4473. Also, 5845 is already closed. > --- Please show the Tarantool branch as well, to show that problem is gone. > GitHub branch: https://github.com/tarantool/luajit/tree/fckxorg/gh-5782-adapt-deep-nest-gsub-PUC-Rio > Issue: https://github.com/tarantool/tarantool/issues/5782 > > test/PUC-Rio-Lua-5.1-tests/pm.lua | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/test/PUC-Rio-Lua-5.1-tests/pm.lua b/test/PUC-Rio-Lua-5.1-tests/pm.lua > index e364ff9d..7da3ef4a 100644 > --- a/test/PUC-Rio-Lua-5.1-tests/pm.lua > +++ b/test/PUC-Rio-Lua-5.1-tests/pm.lua > @@ -206,12 +206,11 @@ function rev (s) > return string.gsub(s, "(.)(.+)", function (c,s1) return rev(s1)..c end) > end > > -local x = string.rep('012345', 10) > --- FIXME: The first Tarantool's fiber has only 512Kb of stack. > --- It is not enough for this recursive call. > +-- This test is adapted to match the stack size (512Kb) of the first fiber in > +-- Tarantool. > -- See also https://github.com/tarantool/tarantool/issues/5782. > --- The test is disabled for Tarantool binary. > --- assert(rev(rev(x)) == x) > +local x = string.rep('01234', 10) > +assert(rev(rev(x)) == x) The patch is looks OK to me, but the main problem is still here: LuaJIT is badly managing C stack overflow. The same chunk rases an error for Lua 5.1, but crashes for LuaJIT. | $ luajit -e 'local function rev (s) return string.gsub(s, "(.)(.+)", function (c,s1) return rev(s1)..c end) end local x = string.rep("0", 1000) rev(x)' | Segmentation fault | $ lua -e 'local function rev (s) return string.gsub(s, "(.)(.+)", function (c,s1) return rev(s1)..c end) end local x = string.rep("0", 1000) rev(x)' | lua: C stack overflow | stack traceback: | [C]: in function 'gsub' | (command line):1: in function 'rev' | (command line):1: in function <(command line):1> | [C]: in function 'gsub' | (command line):1: in function 'rev' | (command line):1: in function <(command line):1> | [C]: in function 'gsub' | (command line):1: in function 'rev' | (command line):1: in function <(command line):1> | [C]: in function 'gsub' | ... | [C]: in function 'gsub' | (command line):1: in function 'rev' | (command line):1: in function <(command line):1> | [C]: in function 'gsub' | (command line):1: in function 'rev' | (command line):1: in function <(command line):1> | [C]: in function 'gsub' | (command line):1: in function 'rev' | (command line):1: in main chunk | [C]: ? So I suppose it is strange to add test that tests nothing. Thoughts? > > > -- gsub with tables > -- > 2.33.0 > -- Best regards, Sergey Kaplun