lua-users home
lua-l archive

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


I am working on a web framework that uses lua embedded in multithreaded web server - https://github.com/sergeyzavadski/breeze.

It uses multiple threads for HTTP requests processing, each having separate lua state

When performing benchmarking tests under linux,  I am intermittently seeing crash in lua garbage collection (as demonstrated by following stacktrace)

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffeee83700 (LWP 23864)]
sweeplist (L=0x7fffc8000020, p=0x7fffc80e9d70, count=65) at lgc.c:742
742    int marked = gch(curr)->marked;
(gdb) backtrace
#0  sweeplist (L=0x7fffc8000020, p=0x7fffc80e9d70, count=65) at lgc.c:742
#1  0x00000000004157a7 in singlestep (L=0x7fffc8000020) at lgc.c:1085
#2  0x0000000000415fe0 in incstep (L=0x879e40) at lgc.c:1139
#3  luaC_forcestep (L=0x879e40) at lgc.c:1157
#4  0x000000000041c7a9 in callTM (L=0x879e40, f=<value optimized out>, p1=<value optimized out>, p2=<value optimized out>, p3=0x8bd680, hasres=1) at lvm.c:103
#5  0x000000000041e4a8 in luaV_execute (L=0x879e40) at lvm.c:613
#6  0x0000000000413909 in luaD_call (L=0x879e40, func=<value optimized out>, nResults=<value optimized out>, allowyield=0) at ldo.c:393
#7  0x0000000000412b18 in luaD_rawrunprotected (L=<value optimized out>, f=<value optimized out>, ud=<value optimized out>) at ldo.c:131
#8  0x0000000000412b83 in luaD_pcall (L=0x7fffc8000020, func=0, u=0x3, old_top=1, ef=140736549923136) at ldo.c:590
#9  0x0000000000410abb in lua_pcallk (L=0x879e40, nargs=2, nresults=0, errfunc=<value optimized out>, ctx=0, k=0) at lapi.c:946
#10 0x0000000000405bc7 in Breeze::onRequest (this=0x661240, request=0x7fffc40c3390, response=0x7fffcc03df50, threadData=<value optimized out>) at src/Breeze.cpp:200
#11 0x000000000040b050 in Server::ProcessPool::handle (this=0x661750, context=0x7fffd4090890, thread=...) at src/Server.cpp:333
#12 0x000000000040b205 in Server::ProcessPool::Thread::routine (this=0x879de0) at src/Server.cpp:369
#13 0x000000000040cf6f in sys::Thread::routineStatic (data="" at src/system.cpp:335
#14 0x00007ffff721f971 in start_thread (arg=<value optimized out>) at pthread_create.c:304
#15 0x00007ffff6f7af3d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#16 0x0000000000000000 in ?? ()

Is this a legitimate lua issue and is there a workaround possible?

Thanks,
Sergey