lua-users home
lua-l archive

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


Stefan wrote:
Is there any 'gotchas' to using luaL_openlibs() from multiple OS threads with separate Lua states?

I am getting a rash of these while opening new Lua states en masse (but only when opening new states):

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x282028b0 (LWP 100257)]
0x280d047a in lua_newstate () from /usr/local/lib/liblua-5.1.so.1
(gdb) bt
#0  0x280d047a in lua_newstate () from /usr/local/lib/liblua-5.1.so.1
#1  0x280c5c48 in lua_rawget () from /usr/local/lib/liblua-5.1.so.1
#2  0x280d47c4 in luaL_findtable () from /usr/local/lib/liblua-5.1.so.1
#3  0x280d4ce9 in luaL_openlib () from /usr/local/lib/liblua-5.1.so.1
#4  0x280d4e07 in luaL_register () from /usr/local/lib/liblua-5.1.so.1
#5  0x280d59ca in luaopen_base () from /usr/local/lib/liblua-5.1.so.1
#6  0x280c9926 in lua_resume () from /usr/local/lib/liblua-5.1.so.1
#7  0x280c9d15 in lua_resume () from /usr/local/lib/liblua-5.1.so.1
#8  0x280c5863 in lua_call () from /usr/local/lib/liblua-5.1.so.1
#9  0x280de481 in luaL_openlibs () from /usr/local/lib/liblua-5.1.so.1
#10 0x00000001 in ?? ()
#11 0x00000000 in ?? ()
#12 0x2820dfd0 in ?? ()
#13 0x2820dfd0 in ?? ()
#14 0x00000064 in ?? ()
#15 0xbe3e8f98 in ?? ()
#16 0x08049d9b in worker_run (a=0x283bd448) at main.c:281
Previous frame inner to this frame (corrupt stack?)

Now the last line makes me think I am doing something asinine within some unrelated code. But I thought I would ask just to make sure.


Nothing to see here, move along please.

Sorry for the noise, it appears that my C string math is a wee bit rusty. My logging was not leaving enough room for the timestamp in the line buffer - which was throughly stomping the stack after thousands of (debug) log lines.

This is what I get for programming in Lua so long... :P