Open
Description
Here is a use-case for debug problem. Assume I have a unit-test that hangs (deadlocks) and I want to use debug probeы to trouble-shoot this situation (get a list of coroutines when the code hands). Currently I have two options:
-
Run code with
-javaagent:...
. This is very inconvenient with gradle-based project (how to I find a path to jar?) and then I have to dokill -5 ...
for which I need to find process PID (which is inconvenient, too) -
Modify my code with
DebugProbes.install()
. This is easier to do from IDE, but still not good and it does not currently install signal handler at all.
So the proposal is two-fold:
- Support system-property based agent installation via
-Dkotlinx.coroutines.debug=agent
system property (that would work only whenkotlinx-coroutines-debug.jar
is in the class-path) - In addition to the above, support console UI for coroutine debugger via
-Dkotlinx.coroutines.debug=console
which is fine for most unit-tests that do not read from console. The console should support commands to dump coroutines hierarchy, dump all stracktraces and/or traces of a specific coroutine (by its id), and ability to cancel any coroutine (that might help trouble-shooting deadlock situations).