Skip to content

Debug probes property-based initialization and console #930

Open
@elizarov

Description

@elizarov

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 do kill -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 when kotlinx-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).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions