lua-users home
lua-l archive

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


I was wondering if it would work on 5.1-work4.  Thanks for checking
that out.  It seems to me that this is a garbage collection bug; my
best theory right now is that the chain of references generated via
upvalues in the code I posted can cause threads to be collected while
references remain.  The other frequent assertion I have seen was in
lfunc.c, line 69, in the function luaF_close.  This function is called
by the garbage collector to clean up a thread.  It appears that the
"openupval" list would sometimes contain corrupted values.


On Sat, 1 Jan 2005 12:23:13 +1000, David Burgess <dburgess@gmail.com> wrote:
> 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.
> >
>