Consequently, I have changed the "dojump" macro in lvm.c to now be:
#define dojump(L,pc,i) { (pc) += (i); luai_threadyield(); base =
L->base; }
/Now, I know that some "dojump" calls are also wrapped inside "Protect"
and therefore the "base = L->base" is going to be duplicated in those
cases. Of course, my optimising compiler removes the redundancy./
Guess what - the problem has gone away and Lua is not failing its
assertions anymore (and my Lua code isn't running off the rails)!!
[...]
Any thoughts or comments??
One possible culprit is the resize of stacks in the garbage collector.
In one phase of the garbage gollection, the collector may shrink
some stacks if they seem too big. So, I guess it may happen that the
collector running in one thread shrinks the stack of another thread.
(Of course that never crossed my mind until now..)
-- Roberto
Roberto - given the infrequent nature of the issue it would appear that
it's a GC inside another thread.