lua-users home
lua-l archive

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


this executes OK on lua-5.1-work4.


On Fri, 31 Dec 2004 18:07:24 -0700, Spencer Schumann
<gauchopuro@gmail.com> wrote:
> I've been experiencing some random crashes within the Lua interpreter
> in code that makes heavy use of coroutines.  I've distilled the
> offending code down to the following:
> 
> -----------------------------------------------------------------
> local thread_id = 0
> local threads = {}
> 
> function fn(thread)
>     thread_id = thread_id + 1
>     threads[thread_id] = function()
>                              thread = nil
>                          end
>     coroutine.yield()
> end
> 
> while true do
>     local thread = coroutine.create(fn)
>     coroutine.resume(thread, thread)
> end
> -----------------------------------------------------------------
> 
> I've run this code under Windows, using builds from several compilers,
> and also under Solaris; the code produces a segfault in under a
> second.
> 
> Enabling lua assertions shows several failed assertions.  The exact
> assertions are sensitive to small changes in the above code; however,
> one consistent assertion failure happens at lgc.c, line 222.
> 
> I plan on digging into this problem further, but I thought I'd post
> the crash-producing code now in case anyone else wants to dig into it.
>