lua-users home
lua-l archive

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


Thought I'd add more evidence for how a mix of standard/dynamic
linkage can cause crashes, sometimes during Lua's garbage collection,
in hopes my post might help someone else down the line.

I had a build problem where I caused Lua's standard libraries to be
loaded both statically and dynamically within the same Lua program.
This caused my program to crash during garbage collection.  Linking
only one way fixed the problem.

Reference this link to the posts that provided the clue that helped me
solve my problem:
http://lua-users.org/lists/lua-l/2004-03/threads.html#00045, subject
"garbage colleciton crash" (colleciton - sic).

I'm using:  Lua 5.1.2 on QNX RTOS 6.3.0, and QNX's compiler toolchain
built on gcc 2.95.3.

Here's a sample crash backtrace from gdb (in case someone searches for
some of these function names from their own crash dump):

---------------------------------

Program terminated with signal 11, Segmentation fault.
#0  0xb031ecee in ?? ()
(gdb) bt
#0  0xb031ecee in ?? ()
#1  0xb031f631 in ?? ()
#2  0xb031f6e0 in ?? ()
#3  0xb031d126 in ?? ()
#4  0x0805dc54 in luaL_openlibs (L=0x0) at linit.c:34
#5  0x080525bb in luaO_fb2int (x=134741312) at lobject.c:50
#6  0x08057d31 in newkey (L=0x807fd40, t=0x8073a40, key=0x1d) at ltable.c:404
#7  0x080517fc in sweeplist (L=0x807fd40, p=0x8073a40, count=242) at lgc.c:414
#8  0x08051934 in checkSizes (L=0x807fd40) at lgc.c:440
#9  0x0805207a in luaC_step (L=0x807fd40) at lgc.c:612
#10 0x080522bc in luaC_link (L=0x807fd40, o=0x806c0c0, tt=8 '\b') at lgc.c:686
#11 0x0804c7dc in lua_gc (L=0x807fd40, what=2, data=0) at lapi.c:947
#12 0x08062056 in luaB_type (L=0x807fd40) at lbaselib.c:221
#13 0x0804f3ff in luaD_poscall (L=0x807fd40, firstResult=0x807fa80)
   at ldo.c:342
#14 0x0805b8d7 in luaV_execute (L=0x807fd40, nexeccalls=1) at lvm.c:617
#15 0x0804f643 in resume (L=0x807fd40, ud=0x807fa74) at ldo.c:404
#16 0x0804c4ed in f_Ccall (L=0x807fd40, ud=0x8047b5c) at lapi.c:833
#17 0x0804e7ac in correctstack (L=0x807fd40, oldstack=0x804c4c8) at ldo.c:130
#18 0x0804f97c in f_parser (L=0x807fd40, ud=0x804c4c8) at ldo.c:493
#19 0x0804c57f in f_Ccall (L=0x807fd40, ud=0x0) at lapi.c:842
#20 0x08049c48 in getargs (L=0x807fd40, argv=0x0, n=0) at lua.c:121
#21 0x0804a276 in dotty (L=0x807fd40) at lua.c:225
#22 0x0804a9b2 in index2adr (L=0x807fd40, idx=0) at lapi.c:51
---Type <return> to continue, or q <return> to quit---
#23 0x0804f3ff in luaD_poscall (L=0x807fd40, firstResult=0x807fa5c)
   at ldo.c:342
#24 0x0804f62c in resume (L=0x807fd40, ud=0x807fa5c) at ldo.c:400
#25 0x0804c656 in lua_dump (L=0x807fd40, writer=0x8047d7c, data=0x8047dec)
   at lapi.c:878
#26 0x0804e7ac in correctstack (L=0x807fd40, oldstack=0x804c5b8) at ldo.c:130
#27 0x0804f97c in f_parser (L=0x807fd40, ud=0x804c5b8) at ldo.c:493
#28 0x0804c694 in lua_status (L=0x807fd40) at lapi.c:887
#29 0x0804aa29 in index2adr (L=0x1, idx=134512100) at lapi.c:59

---------------------------------

Mason Deaver