[Tarantool-patches] [PATCH] serilaizer: check for recursive serialization

Igor Munkin imun at tarantool.org
Wed Sep 16 10:29:16 MSK 2020


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.

> 

<snipped>

> 

-- 
Best regards,
IM


More information about the Tarantool-patches mailing list