Description
I'll start with a repro:
local thread = require("thread")
local co = coroutine.create(function()
coroutine.yield(1)
end)
local function threadBody()
-- to allow the parent process to exit
os.sleep(1)
print(coroutine.resume(co))
end
thread.create(threadBody):detach()
The coroutine is created in a process (I'll refer to it as the Process), and I think /boot/01_process.lua
registers it in the instances
table of the Process. The rest of the code just makes it so that I resume the coroutine after the Process dies a peaceful death. When it does, its list of instances goes poof. So when I finally do a coroutine.resume
, the coroutine isn't listed anywhere. And then assert(process.info(_coroutine.running()), "thread has no proc")
in /boot/01_process.lua
throws a tantrum because it can't find the associated process info.
The same thing happens if I try resuming an orphaned coroutine in an event listener, etc. (My workaround in the meanwhile is to create the coroutine inside a thread body and detach the thread.)
Since coroutine.resume
has an exception for orphans, I believe the other coroutine.
functions, like yield
, should also have such an exception.