Hi. After upgrading Kotlin from 1.8.10 to 1.8.20, I observed a critical issue for
DebugProbes.jobToString
, blocking all threads of my coroutines executor:
• Threads are waiting for
coroutineStateLock
Copy code
at kotlinx.coroutines.debug.internal.DebugProbesImpl.hierarchyToString(DebugProbesImpl.kt:111)
at kotlinx.coroutines.debug.DebugProbes.jobToString(DebugProbes.kt:98)
• In that particular thread dump, the thread holding the lock was doing
Copy code
at kotlin.coroutines.CombinedContext.get(CoroutineContextImpl.kt:120)
at kotlinx.coroutines.JobKt__JobKt.getJob(Job.kt:630)
at kotlinx.coroutines.JobKt.getJob(Unknown Source)
at kotlinx.coroutines.debug.internal.DebugProbesImpl.hierarchyToString(DebugProbesImpl.kt:115)
at kotlinx.coroutines.debug.DebugProbes.jobToString(DebugProbes.kt:98)
Has anyone else encountered something similar?
d
Dmitry Khalanskiy [JB]
04/24/2023, 10:18 AM
cc @Vsevolod Tolstopyatov [JB]
v
Vsevolod Tolstopyatov [JB]
04/24/2023, 5:24 PM
The 1.7.0-Beta and 1.7.0-RC are no longer prone to this issue, the coroutine debugger was made lock-less (i.e.
coroutineStateLock
is gone).
Could you please tell if there is any progress in your application or if you are encountering a deadlock?
It's likely that
hierarchyToString
doesn't scale well with the number of coroutines and, while doing its string concatenation, was preventing your system from doing any progress.
If it is a deadlock though, it's a different issue that is worth investigating
v
Vincent Péricart
04/25/2023, 6:28 AM
Thank you! It looked like there was no deadlock, just extremely slow performance.
I will try to apply 1.7.0-RC and get back to you if I still see the issue.