(BTW, are you using the new lua_callk or similar functions?)
No
Can you try to log the C stack together with the nCcalls
variable (e.g., by capturing the address of a local variable) to check
whether the C stack is also slowly increasing?
I'll add some more logging to the code and/or try to reproduce the error in my lab. I am almost certain it is not the C stack since this problem occurs in the first coroutine and at the top of the stack.
BTW, I noticed that nCcalls is not reset (unwind) if the Lua parser throws an error when nCcalls > 200 and a Lua error function is installed. I made some test code that kept on recursing until nCcalls > 200. An error was thrown and the error function executed, which also failed due to nCcalls being too large. I removed the error handler and nCcalls was correctly unwind.
The test sequence is:
Start -> lua_newthread -> (1)
Recursing:
(1) luaL_loadbuffer -> push error handler -> lua_pcall -> script runs and calls C func that (1)