-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
segfault due to throwing in panic handler #35
Comments
I have a few test cases reproducing this one for my system, but it depends on the DLL you link to; the code you provided works fine for me for example. It's a pretty serious issue though and I'm not sure how to best fix it. Porting all of Lua to D is one option. I suppose recompiling the Lua DLL with the proper flags is another option? |
For me that simple example works with LuaJIT but not with my installed Lua-5.1.4. As http://pgl.yoyo.org/luai/i/lua_atpanic says you may escape // untested
void* stacktop;
auto wrap_call(alias func, Args...)(auto ref Args args)
{
asm { mov stacktop, ESP; }
return func(args);
}
extern(C) void onPanic()
{
asm { mov ESP, stacktop; }
throw new Exception("");
}
void doString()
{
...
wrap_call!lua_pcall(...);
} After reading http://www.lua.org/pil/24.3.1.html I'm really wondering |
@dawgfoto, the effort is to make it unroll the D stack on the way up. If you use pcall, you don't get that. If you use xpcall, you can do the same as the panic function, but with the same problems. |
Since this LuaD functionality has known problems I suggest disabling it by default and adding a compile or runtime option to enable. |
Some more dialogue concerning this issue can be found at issue #40. I hope we can keep it centralized here in the future. |
… travis servers" This reverts commit ebc3203.
This issue has just drawn one of my projects to a crashing halt... what workarounds exist? |
Why aren't we using pcall and catching the error there? Ideally, we could avoid the panic completely... |
The issue is compiler and platform specific. The general fix is to compile Lua with frame pointers intact. Which platform/compiler targets do you have issues with? |
I expect compiling with frame pointers intact would have a very high cost on performance... |
Stack unwinding doesn't work reliably from the panic handler as
it requires C-like stacks and -fno-omit-frame-pointer for the interpreter.
The text was updated successfully, but these errors were encountered: