lua-users home
lua-l archive

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


David Hollander wrote:
> I am experiencing intermittent segfaults when using the FFI, binding
> to the glob headers or poll headers and creating lots of stuff. strace
> reports SEGV_MAPERR, when using x86_64 Linux 3.0.4-1 and GCC 4.6.1-4
> (Arch Linux). The same program does not produce segfaults on Linux
> 2.6.38-10 and GCC 4.5.2-8 (Ubuntu),  or when garbage collection is
> turned off using: garbagecollection 'stop' . The LuaJIT version is the
> git HEAD.

This could be anything, esp. problems in your code with unanchored
GC references to FFI cdata. GC problems usually show up as random
crashes, so it's not surprising to see this happen on one system,
but not on others. I don't think the GCC version has any influence,
except it causes a slightly different memory layout.

SEGV_MAPERR hints that you should check whether all library
handles from ffi.load() are anchored. Most of the time this is
already done indirectly through upvalues (e.g. use of mylib.myfunc
in a Lua function). That's not the only possible cause for this
error, though.

To track the problem down: compile everything with debug symbols,
compile LuaJIT with assertions turned on and run it under gdb.

--Mike