On Sat, Feb 28, 2015 at 4:43 PM, Mike Pall <mike-1502@xxxxxxxxxx> wrote: > John Szakmeister wrote: >> At the moment, it runs about a dozen of the unit tests, and then falls >> over with this error from LuaJIT: >> luajit: lj_ctype.h:395: ctype_check: Assertion `id > 0 && id < >> cts->top' failed. >> >> Can anyone shed light on what this means? Is there something I can do >> to help debug the situation? > > This is an internal assertion that should never trigger. It means > that an out-of-range ctype ID was used. This could be a follow-up > error due to an out-of-bounds write (mistake in the usage of the > FFI) or it might be an issue with LuaJIT itself. > > If possible, please try try to condense this into a small, > isolated testcase that still triggers the same assertion. If this > involves a lot of code and you don't know where to look, try to > successively strip out unrelated stuff. I did manage to create a smaller test case (it at least doesn't involve the Neovim test suite). Unfortunately, as I slimmed things down, the assertion has changed. Also, it's still a substantial amount of code involved since busted (a lua unit test framework) is still in the mix. I suspect it's something that busted is doing that is tripping up LuaJIT though. To create the problem, I used the following two files and shoved them into a simple-tests directory: suite1_spec.lua --------------- local ffi = require('ffi') describe('suite1', function() it('test1', function() end) end) suite2_spec.lua --------------- local ffi = require('ffi') describe('suite2', function() it('test1', function() end) end) I'm using the LuaJIT built as part of Neovim, but your command line should look similar to this once busted is installed (we do that via luarocks): .deps/usr/bin/luajit -- \ .deps/usr/lib/luarocks/rocks/busted/2.0.rc7/bin/busted \ -v -o TAP simple-tests This gives the following assertion: Assertion failed: (g->gc.total == sizeof(GG_State)), function close_state, file lj_state.c, line 169. If I comment either one of the require('ffi') lines out, it runs fine. Perhaps busted is clearing something, and ffi is actually getting loaded twice, even though it shouldn't? I should add that this happens with busted 2.0-rc7. If I use busted 2.0-rc4, it doesn't fail. In fact, it seems like the issue started happening between 2.0rc6 and 2.0rc7. I'll try and bisect it down to the commit that introduced the problem, and hopefully that will provide a better clue. I should mention that I'm running on OSX, though I see the issues in my Ubuntu 12.04 VM too. > The error looks like it's triggered from the interpreter, but it > could still be indirectly caused by JIT-compiled code. Check if > the problem is still present with or without jit.off(). With both assertions, I got the same result with -joff and without it. I did notice one other thing too: passing any -On argument seems to trip luajit: :: .deps/usr/bin/luajit -O0 /Users/jszakmeister/projects/neovim/neovim/.deps/usr/bin/luajit: attempt to index a nil value I hope this is helpful in tracking down the problem. I'm sorry I can't generate a smaller test case than this--I simply don't know enough about lua, busted, and luajit. Thanks! -John