3

I have a Lua script which useslatest lua lanes. I have following script made
for

local lanes = require "lanes"  
lanes.configure()  
require "helper_interfaces"  
--require "assert"  
local cleanup  
local error_func =  function(err)  
                     return debug.traceback(err)  
                    end

local function sample(n)  
   -- set_finalizer(cleanup)  
   local success, result = xpcall(m.usb_lua_printlog("hi\r\n"), error_func)  
   print(success, result)  
   return 2*n  
end

--lanes.configure()  
EnablePrintLog()  
--PrintLog("hi")  
usb_lua_printlog("hi\r\n")  
local lanes_gen = assert(lanes.gen)  
local lanes_linda = assert(lanes.linda)  

--while (true) do  
a1 = lanes_gen("*", { globals =  { ["m"] = require "UsbTestApp" } }, sample)(1)  
a1:join()  
--set_debug_threadname("first")  
while true do  
  str = a1.status  
  --thread_gc(a1)  
  if str == "done" or str == "cancelled" or str == "error" then  
     usb_lua_wait(1000)  
     break  
  end    
end  

my problem is :

Now When I execute it from my Application (On windows) I get the crash while executing it, following is the Call stack while crash.

UsbTestApp.exe!_CrtIsValidHeapPointer(const void * pUserData)  Line 2036    C++  
UsbTestApp.exe!_free_dbg_nolock(void * pUserData, int nBlockUse)  Line 1322 + 0x9         bytes C++  
UsbTestApp.exe!_free_dbg(void * pUserData, int nBlockUse)  Line 1265 + 0xd bytes        C++>  
UsbTestApp.exe!free(void * pUserData)  Line 49 + 0xb bytes  C++  
UsbTestApp.exe!_luaL_loadbuffer()  + 0x42 bytes C  
UsbTestApp.exe!_luaM_realloc_()  + 0x23 bytes   C  
UsbTestApp.exe!_luaH_free()  + 0x2b bytes   C  
UsbTestApp.exe!_luaC_separateudata()  + 0x95d bytes C  
UsbTestApp.exe!_luaC_freeall()  + 0x4ce bytes   C  
UsbTestApp.exe!_luaC_fullgc()  + 0x4f bytes C  
UsbTestApp.exe!_lua_gc()  + 0x3f bytes  C  
UsbTestApp.exe!USB_LUA_TEST_EXECUTE_SCRIPT(lua_State * ulState)  Line 579 + 0xd     bytes   C++  
UsbTestApp.exe!USB_LUA_TEST_SCRIPT_RUN(lua_State * ulState)  Line 461 + 0x9 bytes       C++  
UsbTestApp.exe!_luaD_precall()  + 0x193 bytes   C  
UsbTestApp.exe!_luaD_call()  + 0x3c bytes   C  
UsbTestApp.exe!_lua_pcall()  + 0xd1 bytes   C  
UsbTestApp.exe!_luaD_rawrunprotected()  + 0x53 bytes    C  
UsbTestApp.exe!_luaD_pcall()  + 0x3e bytes  C  
UsbTestApp.exe!_lua_cpcall()  + 0x2f bytes  C  
UsbTestApp.exe!USB_LUA_CREATE_NEW_LUA_STATE(LUA_Script * luaScript)  Line 304 + 0x15       bytes    C++  
UsbTestApp.exe!UsbTestSuiteLIThread(void * lpParam)  Line 162 + 0x9 bytes   C++  

Can Anybody help me try to help me. As include and loading of the lanes.configure() seems to cause this problem May be I am doing something wrong or any suggestion might help. In case if you need more info let me know.

Thanks a lot.

Regards,
Mayur

  • I remember having something similar, but I'd try to localize the problem first by creating the smallest crashing program without dependencies other than lanes first. If configure() is enough to crash, please filter the code then. It might help as well to check your lanes version, whether it's the latest. – Dmitry Ledentsov Jan 24 '13 at 09:46
  • I had done the that at the beginning and it insists me to remove the lua_close() function from my application. As lanes are always opened in a master state, I could assume this behavior. This crash occurs when I am defining some invalid things in my scripts (i.e. mistake in require "" format) then it suddenly crashes rather than handling the errors. – user2004264 Jan 24 '13 at 10:26
  • 1
    try not pass required module via globals to lane_gen(), try to require it inside the lane. i think this may be the cause, but not going to check (i'm on linux no windows), so just commenting instead of answer – VB9-UANIC Jan 28 '13 at 05:54

0 Answers0