Discussion:
First-Chance Exception in luajit
azhwkd
2014-06-12 20:29:35 UTC
Permalink
Greetings all,

I'm trying to tie luajit into my application and I'm successfull for the
most part.
However one thing is going on which urges me to ask here if that's desired
behavior or if I did something wrong on my part.

I'm using luajit statically linked into my application on windows 8.1. Both
luajit and my application
are compiled as 64bit.

My application runs fine, no crashes ... also the lua is executing fine it
seems.
What is happening tho is a
First-chance exception at 0x00007FF9D0F25BF8 (KernelBase.dll) in
Application.exe: 0xE24C4A02.
at uneven intervals. Sometimes it's happening constantly, sometimes it's
silent for a few seconds and then starts spitting this again.

The exception originates from either a lua_pcall or lua_call of my
application.
A typical stacktrace looks like this:

KernelBase.dll!00007ff9d0f25bf8() Unknown
Application.exe!err_raise_ext(int errcode) Line 444 C
Application.exe!lj_err_throw(lua_State * L, int errcode) Line 468 C
Application.exe!lj_trace_err_info(jit_State * J, TraceError e) Line 49 C
Application.exe!recff_nyi(jit_State * J, RecordFFData * rd) Line 114 C
Application.exe!lj_ffrecord_func(jit_State * J) Line 879 C
Application.exe!lj_record_ins(jit_State * J) Line 2065 C
Application.exe!trace_state(lua_State * L, int (lua_State *) * dummy,
void * ud) Line 590 C
Application.exe!lj_vm_cpcall() Unknown
Application.exe!lj_trace_ins(jit_State * J, const unsigned int * pc) Line
647 C
Application.exe!lj_dispatch_call(lua_State * L, const unsigned int * pc)
Line 469 C
Application.exe!lj_vm_hotcall() Unknown
Application.exe!lua_pcall(lua_State * L, int nargs, int nresults, int
errfunc) Line 1052 C
Application.exe!LuaManager::Update(double elapsed) Line 172 C++
Application.exe!App::Update() Line 66 C++
Application.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ *
hPrevInstance, char * lpCmdLine, int nCmdShow) Line 21 C++
Application.exe!__tmainCRTStartup() Line 618 C
Application.exe!WinMainCRTStartup() Line 466 C
kernel32.dll!00007ff9d13616ad() Unknown
ntdll.dll!00007ff9d3a04629() Unknown

or

KernelBase.dll!00007ff9d0f25bf8() Unknown
Application.exe!err_raise_ext(int errcode) Line 444 C
Application.exe!lj_err_throw(lua_State * L, int errcode) Line 468 C
Application.exe!lj_trace_err(jit_State * J, TraceError e) Line 42 C
Application.exe!lj_record_ret(jit_State * J, unsigned int rbase, __int64
gotresults) Line 763 C
Application.exe!lj_ffrecord_func(jit_State * J) Line 883 C
Application.exe!lj_record_ins(jit_State * J) Line 2065 C
Application.exe!trace_state(lua_State * L, int (lua_State *) * dummy,
void * ud) Line 590 C
Application.exe!lj_vm_cpcall() Unknown
Application.exe!lj_trace_ins(jit_State * J, const unsigned int * pc) Line
647 C
Application.exe!lj_dispatch_call(lua_State * L, const unsigned int * pc)
Line 469 C
Application.exe!lj_vm_hotcall() Unknown
Application.exe!lua_call(lua_State * L, int nargs, int nresults) Line 1035
C
Application.exe!lj_cf_package_require(lua_State * L) Line 508 C
Application.exe!lj_BC_FUNCC() Unknown
Application.exe!lua_call(lua_State * L, int nargs, int nresults) Line 1035
C
Application.exe!lj_cf_package_require(lua_State * L) Line 508 C
Application.exe!lj_BC_FUNCC() Unknown
Application.exe!lua_call(lua_State * L, int nargs, int nresults) Line 1035
C
Application.exe!lj_cf_package_require(lua_State * L) Line 508 C
Application.exe!lj_BC_FUNCC() Unknown
Application.exe!lua_call(lua_State * L, int nargs, int nresults) Line 1035
C
Application.exe!LuaManager::LoadFile(Polycode::String path) Line 137 C++
Application.exe!App::runApp() Line 51 C++
Application.exe!WinMain(HINSTANCE__ * hInstance, HINSTANCE__ *
hPrevInstance, char * lpCmdLine, int nCmdShow) Line 17 C++
Application.exe!__tmainCRTStartup() Line 618 C
Application.exe!WinMainCRTStartup() Line 466 C
kernel32.dll!00007ff9d13616ad() Unknown
ntdll.dll!00007ff9d3a04629() Unknown

I compiled luajit with both LUA_USE_ASSERT and LUA_USE_APICHECK but no
assert was hit.

Now the question is if I can ignore this happening or if there is something
borked.

Regards,
Sebastian
Mike Pall
2014-06-12 20:46:04 UTC
Permalink
Post by azhwkd
First-chance exception at 0x00007FF9D0F25BF8 (KernelBase.dll) in
Application.exe: 0xE24C4A02.
at uneven intervals. Sometimes it's happening constantly, sometimes it's
silent for a few seconds and then starts spitting this again.
That's the JIT compiler doing it's work. It throws (and catches)
Lua errors (i.e. exceptions on x64) to back off on uncompileable
or unprofitable traces. That's completely normal.
Post by azhwkd
Now the question is if I can ignore this happening or if there is something
borked.
I suggest to instruct your debugger to ignore exceptions and let
them be caught by the application.

--Mike
azhwkd
2014-06-12 21:03:23 UTC
Permalink
Thanks for your quick answer!
I thought as much as the application was running smoothly, but it still
worried me enough to ask.

Have a nice day!
Post by Mike Pall
Post by azhwkd
First-chance exception at 0x00007FF9D0F25BF8 (KernelBase.dll) in
Application.exe: 0xE24C4A02.
at uneven intervals. Sometimes it's happening constantly, sometimes it's
silent for a few seconds and then starts spitting this again.
That's the JIT compiler doing it's work. It throws (and catches)
Lua errors (i.e. exceptions on x64) to back off on uncompileable
or unprofitable traces. That's completely normal.
Post by azhwkd
Now the question is if I can ignore this happening or if there is
something
Post by azhwkd
borked.
I suggest to instruct your debugger to ignore exceptions and let
them be caught by the application.
--Mike
Loading...