LuaLanes / lanes

Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 to 5.4.
Other
436 stars 93 forks source link

Tests are segfaulting with a high cpu (core) count #192

Closed ConiKost closed 2 years ago

ConiKost commented 3 years ago

Hi! I have here a test machine, which segfaults in executing tests. I can't reproduce that on my normal machine. The only difference is, that the machine, where it works, has a much lower cpu core count. Could be this related?

make -j36 LUA=luajit test 
make errhangtest
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/errhangtest.lua
true    true
false   tried to copy unsupported types
oh boy
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make irayo_recursive
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/irayo_recursive.lua
level 0
level 1
level 2
level 3
level 4
level 5
level 6
level 7
level 8
level 9
level 10
level 11
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make irayo_closure
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/irayo_closure.lua
using the closure
true
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make basic
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/basic.lua

    ---=== Tasking (basic) ===---   

pending pending 
waiting...  
5083    true    
6500    true    
                ---> lane 'task(200,300,4)' collected with status closed    
                ---> lane 'task(100,200,3)' collected with status closed    

    ---=== Tasking (cancelling) ===---  

. running   
............. cancelled 
limited[key] = table: 0x419c73c8    

    ---=== Communications ===---    

1 sent
2 sent
Lane starts!
.1 received
.2 received
..................................................................................................3 sent
3 received
1,2,3 sent
'a' sent
1, 2, 3 received
{'a','b','c',d=10} sent
a received
table received
4 received
{ subT1, subT2, subT1, subT2} sent
Lane ends!
table received
subT1, subT2, subT1, subT2              ---> lane 'chunk' collected with status closed  

    ---=== Stdlib naming ===--- 

                ---> lane 'io_os_f' collected with status closed    
                ---> lane 'io_os_f' collected with status closed    
                ---> lane 'io_os_f' collected with status closed    
                ---> lane 'io_os_f' collected with status closed    
                ---> lane 'coro_f' collected with status closed 

    ---=== Comms criss cross ===--- 

A: Hello
B: Hello
B: I was here first!
A: I was here first!
B: So what?
A: So what?
                ---> lane 'criss cross B -> A' collected with status closed 
                ---> lane 'criss cross A -> B' collected with status closed 

    ---=== Receive & send of code ===---    

linedefined 377 
currentline 381 
func    function: 0x406bb368    
isvararg    false   
namewhat        
lastlinedefined 405 
source  @tests/basic.lua    
nups    2   
what    Lua 
nparams 1   
short_src   tests/basic.lua 
ready!  

    ---=== :join test ===---    

name of function print = '_G/print' 
Done! :)
                ---> lane 'join test lane' collected with status closed 
                ---> lane '<unnamed>' collected with status closed  
                ---> lane 'task(1,999999999,1)' collected with status closed    
wait_send_lane is waiting
wait_send   nil nil
wait_send_lane is cancelled
wait_receive_lane is waiting
wait_receive    nil nil
wait_receive_lane is cancelled
wait_receive_batched_lane is waiting
wait_receive_batched    nil nil nil
wait_receive_batched_lane is cancelled
lane status: running
### checking coroutine lib existence for 'coroutine'
### checking io and os libs existence for '*'
### checking io and os libs existence for 'io,os'
### checking io and os libs existence for 'io+os'
### checking io and os libs existence for 'io,os,base'
joining with 'join test lane'
join test lane  14  13  12  nil
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make fifo
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/fifo.lua
Sending to A..
Sending to B..
Reading A..
FIFO3   1
Reading B..
FIFO4   a
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make keeper
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/keeper.lua
1
1
2
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make timer
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/timer.lua

*** Timers every second (not synced to wall clock) ***

waiting...  1613945300.313
waiting...  1613945301.313
waiting...  1613945302.313
waiting...  1613945303.313
waiting...  1613945304.313

*** Adding timers every 5 second (synced to wall clock) ***

waiting...          1613945304.313
waiting...          1613945305.000
waiting...  1613945305.313
waiting...  1613945306.313
waiting...  1613945307.313
waiting...  1613945308.313
waiting...  1613945309.313
waiting...          1613945310.000
waiting...  1613945310.313
waiting...  1613945311.313

*** Listing timers ***

*** Clearing timers ***

...making sure no ticks are coming...
Linda: 0x55c08c8ea590   1s  1613945312.313  1
Linda: 0x55c08c8ea590   5s  1613945315  5
nil nil
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make atomic
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/atomic.lua
6
5.5
-4.5
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make cyclic
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/cyclic.lua
Via upvalue:    same    same
Via parameters: same    same
Directly recursive:     same
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make objects
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/objects.lua
aaa
bbb
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make fibonacci
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/fibonacci.lua
fib(80)
splitting 80 -> 41 39
fib(41)
splitting 41 -> 21 20
fib(39)
splitting 39 -> 20 19
fib(21)
splitting 21 -> 11 10
fib(20)
splitting 20 -> 11 9
fib(20)
splitting 20 -> 11 9
fib(19)
splitting 19 -> 10 9
fib(9)
fib(9) = 34
fib(9)
fib(9) = 34
fib(11)
fib(11) = 89
fib(9)
fib(9) = 34
fib(20) = 6765
fib(11)
fib(11) = 89
fib(20) = 6765
fib(11)
fib(11) = 89
fib(10)
fib(10) = 55
fib(19) = 4181
fib(39) = 63245986
fib(10)
fib(10) = 55
fib(21) = 10946
fib(41) = 165580141
fib(80) = 2.3416728348468e+16
2.3416728348468e+16 2.3416728348468e+16
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make recursive
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/recursive.lua
depth: 0 1 2 3 4 5 6 7 8 9 10 11
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make func_is_string
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/func_is_string.lua
666 666
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make atexit
make[1]: Entering directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
LUA_CPATH="./src/?.so" LUA_PATH="./src/?.lua;./tests/?.lua" luajit tests/atexit.lua
make[1]: *** [Makefile:167: atexit] Segmentation fault (core dumped)
make[1]: Leaving directory '/var/tmp/portage/dev-lua/lanes-3.13.0-r100/work/lanes-3.13.0-luajit'
make: *** [Makefile:88: test] Error 2
benoit-germain commented 2 years ago

As far as I can tell, Lanes doesn't have a restriction on number of cores. I see the crash is in the atexit test. Difficult to say without at least a stack trace.

ConiKost commented 2 years ago

Thanks, I will see, if I can get a stack trace for you.

benoit-germain commented 2 years ago

I'll have to test the latest Lanes against LuaJIT though, as I see that's what you are using. It works with Lua 5.1, but maybe something got broken somewhere...

benoit-germain commented 2 years ago

Just tested atexit.lua against LuaJIT 2.0.5, 2.1.0-beta3 and MoonJIT Win32 and x64, no issue on my side.