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 93D2C6B944; Tue, 13 Apr 2021 18:54:16 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 93D2C6B944 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618329256; bh=qTdG8hGP2PlOrb7ASapDB+sjYFQvTbENrKHvmN3a8TI=; h=To:References:Date:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=b7JjIWdpzYQXqwp8sGQxwiuhx5fGbuMj5uQjT2TZZWYCfBhiLSQn49MT7KmFeygXx z+9poJRxHl6XcjrJKTdy5hAU5g7Ne/GzMgZe7+woyk+K0ffkvMKU5UGD9nAo2pbICe LLL7/6WflgGqeu78y1SL6jf8J7m6C6JZKynccVx8= 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 BB7A06BD2D for ; Tue, 13 Apr 2021 18:54:15 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org BB7A06BD2D Received: by smtpng2.m.smailru.net with esmtpa (envelope-from ) id 1lWLMk-0005SR-Vu; Tue, 13 Apr 2021 18:54:15 +0300 To: Roman Khabibov , tml References: <20210311054949.91263-1-roman.habibov@tarantool.org> Message-ID: <9edf496a-3681-44f9-6e89-1d44bcc193b2@tarantool.org> Date: Tue, 13 Apr 2021 18:54:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210311054949.91263-1-roman.habibov@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E74807BAE725B9AE625DE765B0E193B5B7687182A05F53808504024223E5A287B0348ED8D2AEC62B6564CC6BD8AAC457155B2857BA51EE4FD8240 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7023D31FF4FEF767AEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637AD1E1BF10F09609D8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2580EC87FD6069C25E4313107C4C32EA83999716826408816D2E47CDBA5A96583C09775C1D3CA48CFCA5A41EBD8A3A0199FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C317B107DEF921CE79117882F4460429728AD0CFFFB425014E868A13BD56FB6657E2021AF6380DFAD18AA50765F790063735872C767BF85DA227C277FBC8AE2E8B6DD2A13FB396801375ECD9A6C639B01B4E70A05D1297E1BBCB5012B2E24CD356 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2AD77751E876CB595E8F7B195E1C97831B005ABFBEFF0070AE39BF8F5EB72FA2C X-C1DE0DAB: 0D63561A33F958A512CF55086A603B161459862CBE9E5CAEE63974D82D987D21D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D344FDECC3B9E4D57D4B848A75BB035CCDE71CC63F733FDA6268EEE90325BF2147635BC681AF391A5D71D7E09C32AA3244C7CD6AECCF8B462A8801C3158F86E8B398A6D4CC6FBFAC251729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnA7/qPBUIXH8IoCTaGzRfw== X-Mailru-Sender: 689FA8AB762F73936BC43F508A0638221166508B2DF13A537135C5BDA3200A16DD788429FD8613638ED9BB8B05EE7B3AFB559BB5D741EB96D19CD4E7312BAA970A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH] serializer: serialize recursive structures 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" Hello! thanks for the patch! 1. I have reverted all changes and test passed. 2. In commit message you declares recursive structures support. What is the max supported depth of recursive structure? I believe it is worth to describe possible limitations in commit message. See inline On 11.03.2021 08:49, Roman Khabibov via Tarantool-patches wrote: > Fix bug with bus error during serializing of recursive > structures. > > Closes #3228 > --- > > Branch: https://github.com/tarantool/tarantool/tree/romanhabibov/gh-3228-visited-set > Issue: https://github.com/tarantool/tarantool/issues/3228 > > src/box/lua/call.c | 6 +- > src/box/lua/execute.c | 2 +- > src/box/lua/serialize_lua.c | 96 ++------ > src/box/lua/tuple.c | 2 +- > src/box/sql/func.c | 2 +- > src/lua/msgpack.c | 10 +- > src/lua/pickle.c | 2 +- > src/lua/utils.c | 226 ++++++++++++++++-- > src/lua/utils.h | 43 +++- > ...-3228-serializer-look-for-recursion.result | 67 ++++++ > ...228-serializer-look-for-recursion.test.lua | 17 ++ > test/swim/swim.result | 18 +- > third_party/lua-cjson/lua_cjson.c | 4 +- > third_party/lua-yaml/lyaml.cc | 88 +++---- > 14 files changed, 390 insertions(+), 193 deletions(-) > create mode 100644 test/app/gh-3228-serializer-look-for-recursion.result > create mode 100644 test/app/gh-3228-serializer-look-for-recursion.test.lua > diff --git a/test/app/gh-3228-serializer-look-for-recursion.test.lua b/test/app/gh-3228-serializer-look-for-recursion.test.lua > new file mode 100644 > index 000000000..1c9b0375f > --- /dev/null > +++ b/test/app/gh-3228-serializer-look-for-recursion.test.lua > @@ -0,0 +1,17 @@ > +test_run = require('test_run').new() > + > +-- > +-- gh-3228: Check the error message in the case of a __serialize > +-- function generating infinite recursion. > +-- > +setmetatable({}, {__serialize = function(a) return a end}) > +setmetatable({}, {__serialize = function(a) return {a} end}) > +setmetatable({}, {__serialize = function(a) return {a, a} end}) > +setmetatable({}, {__serialize = function(a) return {a, a, a} end}) > +setmetatable({}, {__serialize = function(a) return {{a, a}, a} end}) > +setmetatable({}, {__serialize = function(a) return {a, 1} end}) > +setmetatable({}, {__serialize = function(a) return {{{{a}}}} end}) > +setmetatable({}, {__serialize = function(a) return {{{{1}}}} end}) 3. Are you sure 4 levels depth is enough to check recursive structure? What is about testing max depth? > +b = {} > +setmetatable({b}, {__serialize = function(a) return {a_1 = a, a_2 = a, b_1 = b, b_2 = b} end}) > +setmetatable({b}, {__serialize = function(a) return {a_1 = a, a_2 = {a, b}, b = b} end}) > diff --git a/test/swim/swim.result b/test/swim/swim.result > index bfc83c143..539131677 100644 > --- a/test/swim/swim.result > +++ b/test/swim/swim.result > @@ -1322,16 +1322,13 @@ m_list > incarnation: cdata {generation = 0ULL, version = 1ULL} > uuid: 00000000-0000-1000-8000-000000000002 > payload_size: 0 > - - uri: 127.0.0.1: > - status: alive > - incarnation: cdata {generation = 0ULL, version = 2ULL} > - uuid: 00000000-0000-1000-8000-000000000001 > - payload_size: 8 > - - uri: 127.0.0.1: > + - &0 > + uri: 127.0.0.1: > status: alive > incarnation: cdata {generation = 0ULL, version = 2ULL} > uuid: 00000000-0000-1000-8000-000000000001 > payload_size: 8 > + - *0 > ... > e_list > --- > @@ -1374,16 +1371,13 @@ fiber.sleep(0) > -- Two events - status update to 'left', and 'drop'. > m_list > --- > -- - uri: 127.0.0.1: > - status: left > - incarnation: cdata {generation = 0ULL, version = 1ULL} > - uuid: 00000000-0000-1000-8000-000000000002 > - payload_size: 0 > - - uri: 127.0.0.1: > +- - &0 > + uri: 127.0.0.1: > status: left > incarnation: cdata {generation = 0ULL, version = 1ULL} > uuid: 00000000-0000-1000-8000-000000000002 > payload_size: 0 > + - *0 > ... > e_list > --- 4. How changes in swim test related to patch? It is not clear from commit message.