lua-users home
lua-l archive

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


While working on a project, I encountered what I think is a bug in Lua 5.4-work2's generational garbage collection as it interacts with LPEG.

It produces output like:
lua5.4: attempt to call a nil value
stack traceback:
[C]: in function 'lpeg.match'
./parser.lua:167: in function 'parser.parse'
(...tail calls...)
or
lua5.4: ./parser.lua:167: back reference '(null)' not found
stack traceback:
[C]: in function 'lpeg.match'
./parser.lua:167: in function 'parser.parse'
(...tail calls...)

Switching to collectgarbage('incremental') prevents the errors from occurring, and they don't occur in Lua 5.2, 5.3, or LuaJIT.

A full copy of the repository with the bug present can be found at: https://bitbucket.org/spilt/nomsu/get/lua_gc_bug.tar.gz (requires LPEG to be installed) and I included a script called "reproduce_bug.sh" that will reproduce the bug (usually works on the first attempt, but the script will retry if it doesn't). I'm not sure if this is a bug with LPEG or Lua 5.4, but I figured I'd report it and include a reliable way to reproduce the bug.

Attachment: signature.asc
Description: Message signed with OpenPGP