From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [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 1DE6F469719 for ; Wed, 16 Sep 2020 10:39:47 +0300 (MSK) Date: Wed, 16 Sep 2020 10:29:16 +0300 From: Igor Munkin Message-ID: <20200916072916.GL18920@tarantool.org> References: <20200710120109.91675-1-roman.habibov@tarantool.org> <20200710122958.GF1999@grain> <20200714094533.GK5559@tarantool.org> <20200714104027.GF296695@grain> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Tarantool-patches] [PATCH] serilaizer: check for recursive serialization List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Khabibov Cc: tarantool-patches@dev.tarantool.org Roma, On 14.09.20, Roman Khabibov wrote: > Hi, Cyrill and Igor! > > I tried to compare the addresses of the previous and the current iteration, > if they are equal, then throw "looks like recursion, bad function!”. Could you please share your patch? > But I got swim tests failing. That is, they use some recursive > serializers that do not overflow the stack. Is it done intentionally or this behaviour can be changed? > Therefore, I settled on the idea of introducing a recursion limit. Nevertheless, I still propose one of the following: * make the limit configurable via box interface * introduce a "soft" limit to inform user when recursion occurs (e.g. using log with "WARN" facility) and a "hard" one to stop the instance IMHO, the best is to implement both proposals. Thoughts? Side note: __tostring Lua metamethod obligues user to yield a string, but I see __serialize method doesn't have such restrictions. Otherwise, the fix would be brief and clear. > > -- Best regards, IM