lua-users home
lua-l archive

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

Andrew Yount wrote:
> Can anyone give me any hints as to what *might* cause this crash? 
> Any suggestions or clues will be helpful.  It seems at first glance
> that there is a table with a nil key, but I don't know how that could
> possibly come into existence in the first place.   
> Crash details:
> ---------------------this is the code-----------------------
> X:\<snip>\lua\src\lgc.c line number 190
> static int traversetable (global_State *g, Table *h) {
> <snip>
>     else {
>       lua_assert(!ttisnil(gkey(n))); // looks like we hit this assert
>       if (!weakkey) markvalue(g, gkey(n));
>       if (!weakvalue) markvalue(g, gval(n));
>     }
>   }
>   return weakkey || weakvalue;
> }
> ---------------------this is the callstack-----------------------
>    Type   Function
>    int    traversetable(global_State * g, Table * h)
>    l_mem  propagatemark(global_State * g)
>    l_mem  singlestep(lua_State * L)
>    void   luaC_step(lua_State * L)
>    int    lua_gc(lua_State * L, int  what, int  data)
>    void   LUA::ScriptManager::CollectGarbage()
>    void   LUA::ScriptManager::Update()
> <snip>
>    int    main(int  argc, char ** argv)
>           _initialize()
>           _start()

I had a very similar crash in my application recently (I don't remember
the exact stack, but it was happenning in garbage collection). It was
because I was writing beyond a userdata allocated memory block. I was
creating a userdata the size of 3 floats and some code was assuming it
had 4, so writing the 4th was overwriting some Lua internal state data
and led to a crash much later in garbage collection.

Since your table contain userdata that might be the source of the
problem. In my case I dichotomically disabled some code until I found
which line was causing the crash, and that line was the function call
that did create the faulty userdata.

Also, btw, Lua is not an acronym ;-)