I have a coroutine that is deadlocked (not paused)...
# coroutines
z
I have a coroutine that is deadlocked (not paused), and I need to identify which one it is. I’m able to print the following log:
Copy code
[LazyDeferredCoroutine{Active}@9925657, IdlingResourceDispatcher@c1fc9e5] coroutine is still running
I also have access to the
CoroutineContext
and
Runnable
inside of CoroutineDispatcher.dispatch:
Copy code
override fun dispatch(context: CoroutineContext, block: Runnable)
any way to throw an exception or something here and have it show me which coroutine is deadlocked?
I can get the
job
of the
CoroutineContext
- but I need to fail it with an exception - not cancel it normally via
job.cancel(cancellationException)
d
Is it possible to use https://github.com/Kotlin/kotlinx.coroutines/tree/master/kotlinx-coroutines-debug in your scenario? I'd just take the dump of all running coroutines and look at their stacktraces.