lua-users home
lua-l archive

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



Another game using Lua 5.1, World of Warcraft, occasionally runs into a similar issue.  So far here it has been at a frequency where we do get a steady, small number of user-submitted error reports, but not high enough that it's ever been reproduced here.

We'd be very interested in a test script if you have something that has demonstrated a GC/corruption problem with good reproducibility for you.  Is it just that one liner or something a little lengthier ?

Rob


On Jan 23, 2008, at 3:09 PM, Andrew Yount wrote:

(This is the second time I sent this message -- it never showed up on the list the first time, for me.  Apologies if this shows up multiple times)
 
 
Hi, I'm looking for some help figuring out a crash we're seeing in the garbage collection process.
 
We're using LUA 5.1 on the PS3 for game logic scripting.  We have already shipped games using this technology with no problems (Ratchet & Clank Future).  On our current project, however, we've run into an odd crash.  Whenever a specific script is loaded, the game will crash deep in the LUA garbage collection code.  The script in question is unremarkable -- it just creates a bunch of very simple tables in the form:
 
TableName = { Var1, Var2, Var3, Var4, <etc> }
 
... essentially just creating groups of userdata objects.  It also defines a handful of very simple functions.  It is possible that this script is not directly responsible, but is instead indirectly putting the LUA state into some odd condition.  If we don’t run the script, LUA runs fine. 
 
We are using a slightly modified version of LUA (floats instead of doubles) and a modified version of toLua for bindings (probably not relevant).  However, like I said, these systems have been used for a long time without this crash occurring.
 
I've ruled out app-side memory allocation problems with about 99% certainty (we have a lot of memory logging going on, and a ton of free memory for LUA to use).
 
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()        
 
Thanks,
 
Andrew Yount
Lead Programmer, Insomniac Games