[Tarantool-patches] [PATCH] box/error: ref error.prev while accessing it

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Sat Apr 18 02:58:08 MSK 2020


On 17/04/2020 22:06, Nikita Pettik wrote:
> On 16 Apr 23:17, Vladislav Shpilevoy wrote:
>> Hi! Thanks for the fixes!
>>
>> Now there is a new problem:
>>
>>     value = 2147483647 + 100
>>     e1 = box.error.new(1000, 'Message1')
>>     e2 = box.error.new(1001, 'Message2')
>>     e1:set_prev(e2)
>>     prev = nil
>>     for i = 1, value do prev = e1.prev end
> 
> Oh, if user wrote code like this I guess negative reference
> counter would be fair panishment.

Actually there was a real problem with that, but with tuples.
They have uint32 ref counter, and it really can overflow in Lua
sometimes, when GC is too lazy, and the same tuple is got
many many times from space:get(). That was fixed by separating
one bit as a flag of having an external 'big-ref' uint64 number.

So a user won't write exactly the same stupid code, but it
achievable implicitly, so as you won't even notice.


More information about the Tarantool-patches mailing list