lua-users home
lua-l archive

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


I tried using debug.setcstacklimit when I first encountered this issue, but regardless of the value I set (in the whole range, from 100 to 39999) it always ends up with a stack overflow in the coroutine. Anyways, if stack behaviour will be reverted back in the next version, then I'll wait for it.

Il giorno dom 1 nov 2020 alle ore 21:31 Roberto Ierusalimschy <roberto@inf.puc-rio.br> ha scritto:
> After trying to update one of my projects from using lua 5.3 to lua 5.4, I
> encountered issues regarding recursion in c functions if it's happening in
> coroutines.
> The following code works correctly if it's compiled using lua 5.3, but
> breaks with a stack overflow error when benign run using lua 5.4
>
> https://pastebin.com/i8f8gVA0
>
> Meanwhile an equivalent function written in lua works as expected
>
> https://pastebin.com/rF2M7h8L
>
> It might be related to the restructuring of the c stack handling happened
> in 5.4, but in the incompatibilities section of the release notes there's
> nothing regarding this change in behaviour, that's why I think it might be
> a bug, is this intended?

See the function debug.setcstacklimit. You probably has to set a
larger C stack. (Or wait for 5.4.2; we are reversing back to a
stackless implementation, which uses less C-stack space.)

-- Roberto