CC: Tweaked

CC: Tweaked

42M Downloads

Better thread dumps when force-killing a computer

SquidDev opened this issue ยท 0 comments

commented

When a computer fails to respond to termination requests we print out a stack trace of the executor's thread. However, most of the time this contains little interesting information - just being a call to LuaThread.run and then waiting on a condition (see #1177 for instance).

It would be nice if we could print out the trace of the currently running Lua thread as well, to see where execution is blocked.

This will probably require the following changes:

  • Cobalt will either need to track the set of all active threads (we could simply add/remove the current thread from a set inside our executor task) or at least the current coroutine's thread.
  • Then we'll need a chain of dumpState(StringBuilder) methods in ILuaMachine and ComputerExecutor, which ComputerThread can call. Slightly irritating how coupled everything is here.

It does occur to me that we could also dump the current Lua stack frame, which might be useful?