lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 29 June 2017 at 11:21, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> Lua version is 5.2.4
>> During gc atomic phase, markbeingfnz() mark mark all objects in list of
>> tobefnz:
>> [...]
>> Suppose "Mt" is the metatable of userdata A and B,
>> and "Mt" also has __gc finalizer, "Mt" will be linked to g->gray twice,
>> first by userdata B   : reallymarkobject(g, B)   -> markobject(g,
>> B->metatable) -> linktable
>> second by "Mt" itself: reallymarkobject(g, Mt) -> linktable
>
> I did not test your code, but your explanation is convincing. (Except
> that it is not clear to me what is the role of 'A' in it.) The bug
> is there.
>
> I don't think 5.3 has this problem. (In 5.3, being-finalized objects
> go through GC cycles like everybody else, so it never forces a mark
> in an object.)
>
> Many thanks for your report.

I ran the code and the problem does not happen in 5.3.4. I had 5.2.3
and 5.2.4 handy, and it happens in both.

-- Hisham