Issue
Failing test suite all.lua.
all.lua file used as a test suite, it sets up the environment and executes multiple tests.
The all.lua execution failure can be tofo with all.lua itself or with the invoked induvisual tests.
Steps to reproduce
$ ../src/lua -e"_U=true" all.lua
Starting Tests
random seeds: 1692615247, 27885112
current path:
****/usr/local/share/lua/5.4/?.lua;/usr/local/share/lua/5.4/?/init.lua;/usr/local/lib/lua/5.4/?.lua;/usr/local/lib/lua/5.4/?/init.lua;./?.lua;./?/init.lua****
---- total memory: 35.8K, max memory: 35.8K ----
time: 3e-05 (+3e-05)
***** FILE 'main.lua'*****
Segmentation fault (core dumped)
Notes
all.lua file overrides the native dofile function https://github.com/ykjit/yklua/blob/main/tests/all.lua#L143
Where each test file:
- loaded
- stringified to a binary representation
- loaded back from binary
- executed as a function
Based on the attached backtrace, it looks like we have an exception when freeing YK trace locations, probably caused by this dump/load process. Needs further investigation 🕵️
Backtrace
Program received signal SIGSEGV, Segmentation fault.
core::sync::atomic::AtomicUsize::fetch_sub (self=0xfffffffffffffff0) at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/core/src/sync/atomic.rs:2540
2540 /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/core/src/sync/atomic.rs: No such file or directory.
(gdb)
(gdb)
(gdb) bt
#0 core::sync::atomic::AtomicUsize::fetch_sub (self=0xfffffffffffffff0)
at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/core/src/sync/atomic.rs:2540
#1 alloc::sync::{impl#27}::drop<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ykrt::location::HotLocation>> (self=0x7fffffffcc20)
at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/alloc/src/sync.rs:1864
#2 0x00007ffff7b062eb in core::ptr::drop_in_place<alloc::sync::Arc<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ykrt::location::HotLocation>>> ()
at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/core/src/ptr/mod.rs:497
#3 0x00007ffff7b2eabe in core::mem::drop<alloc::sync::Arc<lock_api::mutex::Mutex<parking_lot::raw_mutex::RawMutex, ykrt::location::HotLocation>>> (_x=...)
at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/core/src/mem/mod.rs:987
#4 0x00007ffff7b0a4c0 in ykrt::location::{impl#1}::drop (self=0x7fffffffcc78) at ykrt/src/location.rs:196
#5 0x00007ffff7b04d3b in core::ptr::drop_in_place<ykrt::location::Location> ()
at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/core/src/ptr/mod.rs:497
#6 0x00007ffff7b04fdd in core::mem::drop<ykrt::location::Location> (_x=...) at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/core/src/mem/mod.rs:987
#7 0x00007ffff7b04cdd in ykcapi::yk_location_drop (loc=...) at ykcapi/src/lib.rs:87
#8 0x000000000088aede in free_loc (f=<optimised out>, i=<optimised out>, idx=<optimised out>) at lyk.c:66
#9 0x000000000088b075 in yk_free_locactions (f=0x926290) at lyk.c:76
#10 0x0000000000807c08 in luaF_freeproto (L=0x916e38, f=0x926290) at lfunc.c:276
#11 0x000000000080a4ae in freeobj (L=0x916e38, o=0x926290) at lgc.c:767
#12 0x0000000000815358 in deletelist (L=0x916e38, p=0x926290, limit=<optimised out>) at lgc.c:1494
#13 0x0000000000815164 in luaC_freeallobjects (L=0x916e38) at lgc.c:1511
#14 0x000000000084fd4d in close_state (L=0x916e38) at lstate.c:276
#15 0x00000000008503ce in lua_close (L=0x916e38) at lstate.c:421
#16 0x00000000007d9aa0 in main (argc=<optimised out>, argv=<optimised out>) at lua.c:663
Versions
YKLua - main/0a80b8adafdba03d111dcc5e032ce3d6e3c913f7
YK - master/a690e6eaf7253a4fa9c04bb54406c07b7efc0085
Issue
Failing test suite
all.lua.all.luafile used as a test suite, it sets up the environment and executes multiple tests.The
all.luaexecution failure can be tofo withall.luaitself or with the invoked induvisual tests.Steps to reproduce
Notes
all.luafile overrides the nativedofilefunction https://github.com/ykjit/yklua/blob/main/tests/all.lua#L143Where each test file:
Based on the attached backtrace, it looks like we have an exception when freeing YK trace locations, probably caused by this dump/load process. Needs further investigation 🕵️
Backtrace
Versions
YKLua -
main/0a80b8adafdba03d111dcc5e032ce3d6e3c913f7YK -
master/a690e6eaf7253a4fa9c04bb54406c07b7efc0085