luajit 2.1 crash by intensive coroutine use

  • From: "Janis Britals" <jbritals@xxxxxxxxx>
  • To: <luajit@xxxxxxxxxxxxx>
  • Date: Tue, 4 Mar 2014 15:19:09 +0100

Hi Mike,

We have been struggling for some time with random crashes that seemed
somehow to be connected with our use of coroutines (which is quite
intensive), and at last I managed to distill it down to the following test
case:


        local n = 0
        local function nxt()
                n = n + 1
                return n < 100000 and (n % 100 == 0 and 2 or 1) or nil
        end

        local f = {
                coroutine.wrap(function() while true do coroutine.yield()
end end),
                function() end,
        }

        for i in nxt do
                f[i]()
        end

Just running this chunk in either Windows or Linux produces a segfault.
Switching off JIT (-joff) makes the problem go away so it has something to
do with compiled code.

I hope you can quickly find the cause as this is quite central to our
application.

Janis


Other related posts: