You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lua-l
I'm using Lua 5.4.6 on Ubuntu 64-bit, and have run into an odd problem. I'm adding luaunit tests to a library project which I'm developing, and I've just started hitting random failures. By which I mean that when I run the tests using "lua test.lua", I sometimes get all 46 tests passing, and at other times random failures in different parts of the test suite, despite no changes having been made to the code or test data between the test runs. The behavior should depend only on the test files and the code, and when I've hit this problem in other environments it's been down to uninitialized data. Is it possible to have such a thing in Lua? My project is all pure Lua code, except for the tests which use luafilesystem and luaunit (I think luafilesystem is implemented in lfs.so, so not pure Lua).
I'm an experienced developer but this is my first Lua project. Can anyone here suggest how to diagnose the problem/what sort of area to look into? The behavior is the same with Lua 5.4.8.
Thanks and regards,
Vinay Sajip
Sainan
unread,
Oct 31, 2025, 6:15:54 AM (7 days ago) Oct 31
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lu...@googlegroups.com
Maybe a bit of narrowing down about what exactly is failing would help provide an explanation? :D
But non-determinism needn't be a memory issue, for example the ordering of a table's hash part could just as well cause some assumption in your tests to break.
-- Sainan
Jean-Philippe Humbert
unread,
Oct 31, 2025, 8:11:24 AM (7 days ago) Oct 31
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lu...@googlegroups.com
Hi,
An idea: maybe you are working/ testing with Lua tables with the pair function. This function doesn’t guarantee the order.
So it can happen , that sometimes your test doesn’t get the key value in an order it expects them.
Regards
Jp
Envoyé de mon iPhone
> Le 31.10.2025 à 11:16, 'Sainan' via lua-l <lu...@googlegroups.com> a écrit :
>
> Maybe a bit of narrowing down about what exactly is failing would help provide an explanation? :D
>
> But non-determinism needn't be a memory issue, for example the ordering of a table's hash part could just as well cause some assumption in your tests to break.
>
> -- Sainan
>
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lu...@googlegroups.com
Garbage collection issue maybe? The test framework probably has some before/after handlers. Add 2 calls to collectgarbage() in there (to run between tests) to verify if this is the problem.
(note: you have to call it twice, the first call will run the finalizers, the second call will then actually clean them up).
easy check to rule it out
Thijs
Vinay Sajip
unread,
Oct 31, 2025, 1:00:43 PM (7 days ago) Oct 31
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lua-l
>
Maybe a bit of narrowing down about what exactly is failing would help provide an explanation?
Sure, but I didn't want to post lots of code and expect anyone to wade through it. Some of the replies here (including yours) have given me ideas of how to dig into things further. Thanks to all for the suggestions!