-
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
unittests crash on exit with dmd 2.067 and dmd 2.068 #93
Comments
A cursory look at the backtrace seems to suggest that there's a GC-allocated array containing I've thought about this issue before but it wasn't critical until recently. Maybe a solution would be to change |
I assume a LuaObject is guaranteed to be associated with only one LuaState, yes? Just off the top of my head: if LuaState can know about all its LuaObject's then it can scan through them all in its destructor and manually call their destructors where necessary (being careful not to use the GC inside a destructor that is itself called by the GC). It will be relatively slow, but it might not matter that much seeing as LuaState destruction should be pretty rare and outside any hot paths. |
This may be the same issue, or it might not be. But everything works for me except writing a D module for use in Lua. That segfaults. Tried it on two different machines both running arch linux 64 bit. There's also another question about scope for building a related project to work with LuaJIT, which is used by Facebook's iTorch and can be used interactively from the Jupyter/ipython notebook. I am not sure, but it seems to me the sensible approach with LuaJit is to make use of it's FFi interface - you can just specify C headers as a string. It can deal with C structs and C 'arrays' natively and allows you to create metatables for C functions and data structures. So starting from base zero, what I am inclined to do there is use Adam Ruppe's dtoh to generate the C headers. But one would still need to wrap D methods and arrays (turning a D array into a ptr/length pair and adding some sugar) on both the D and Lua side. I guess you don't have time or interest to work on this together, but I thought I would mention my idea here out of courtesy. I may post something on the forum when time. Laeeth. |
Assuming you are building a shared library; are you initializing the D runtime? A segfault report isn't very useful without at least a stack trace.
You can already use LuaJIT simply by linking with it. Completing the higher level interface built on the standard Lua C API is a priority over optimizing for LuaJIT's non-standard interfaces. Apropos this issue, I have been working on a patch which turned out to be fairly involved but it shouldn't be a problem in theory. I just need to plow through various bugs. |
Hi - yes I have tried initializing the D runtime, both via the
|
Yes, that will be enough. LuaJIT is designed to work as a drop-in replacement. Note that the Lua version supported by LuaD is 5.1.x. |
stack trace: |_ | | | JIT: ON SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse Program received signal SIGSEGV, Segmentation fault. |
From 2.067 onwards, structs on the GC heap (with exception of in AAs until 2.068.0) will have their destructors called before being freed/collected. I suspect that this change is the cause of these segfaults.
Here's a backtrace:
The text was updated successfully, but these errors were encountered: