I'm trying to debug coroutines using a javaagent f...
# coroutines
a
I'm trying to debug coroutines using a javaagent form the
kotlinx-coroutines-debug
library. After sending a
SIGTRAP
signal there are coroutines stacktraces like following:
Copy code
Coroutine StandaloneCoroutine{Active}@4491c16c, state: SUSPENDED
        ...

Coroutine StandaloneCoroutine{Active}@27559007, state: SUSPENDED
        ...
However it is not possible to understand which stack belongs to which coroutine. All my coroutines have unique names. Is it possible to activate printing of coroutine names?
There is an example of such a coroutine stacktrace on https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-debug/README.md:
Copy code
Coroutine "coroutine#2":DeferredCoroutine{Active}@289d1c02, state: SUSPENDED
So I'm wondering is it a regression or there is a possibility to activate the feature.
r
According to the sources, that string contains just the result of
toString()
of the continuation, which doesn't contain the name of the coroutine.
a
Yeah. I've found it. And there is also a bug in tests. I'm trying to fix it and possibly will make a PR
r
By the way, I recommend the library for fixing exception stack traces in coroutine code.
a
toString()
method of a coroutine contains its name if following property is set:
Copy code
-Dkotlinx.coroutines.debug=on