Re: Assertion error...

  • From: John Szakmeister <john@xxxxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Sun, 1 Mar 2015 08:47:50 -0500

On Sun, Mar 1, 2015 at 8:04 AM, John Szakmeister <john@xxxxxxxxxxxxxxx> wrote:
[snip]
> 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.

For at least this current issue (with the assertion of gc state
related bits), this commit in Busted seems to be what started
it:

commit b3993e681e6aa91df3ed9a20ecb572532ac4c2c3
Author: Oscar Lim <olim@xxxxxxxx>
Date:   Fri Feb 13 00:06:28 2015 -0800

    Close Lua state on exit

    Calls `os.exit` with `close=true` to allow Lua to close the Lua state
    before exiting.

diff --git a/busted/runner.lua b/busted/runner.lua
index 9337863..3e26b82 100644
--- a/busted/runner.lua
+++ b/busted/runner.lua
@@ -78,13 +78,13 @@ return function(options)
   -- Parse the cli arguments
   local cliArgs, hasError = cli:parse()
   if hasError then
-    os.exit(1)
+    os.exit(1, true)
   end

   -- Return early if only asked for the version
   if cliArgs.version then
     print(busted.version)
-    os.exit(0)
+    os.exit(0, true)
   end

   -- Load current working directory
@@ -154,7 +154,7 @@ return function(options)
     for _, included in pairs(tags) do
       if excluded == included then
         print('Cannot use --tags and --exclude-tags for the same tags')
-        os.exit(1)
+        os.exit(1, true)
       end
     end
   end
@@ -368,5 +368,5 @@ return function(options)
       exit = 255
     end
   end
-  os.exit(exit)
+  os.exit(exit, true)
end

The code has changed somewhat since then, and now there's an
osexit() function in busted/compatibility.lua to help run GC
before exiting.  But changing the last line of it from
`os.exit(code, close)` to just `os.exit(code)` makes my simple
test case run successfully.

Reverting this bit doesn't fix the ctype assertion though.  I'll
keep hunting for that one.

-John

Other related posts: