You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that the debug info for the second coroutine does not show the effect of withContext switch.
This is likely because kotlinx.coroutines.debug.internal.DebugCoroutineInfoImpl has immutable context and it is not updated from the frame in updateState.
The issue occasionally shows up in problem investigations, wrong context in the debug probes causes confusion.
The text was updated successfully, but these errors were encountered:
That's a long-standing debate (#3414 (comment)) about whether withContext is a new coroutine or not (and, for the change, coroutineScope) and is done on purpose in the current implementation. You can see that the actual contextual data is attached to the launched job context, including the name.
We can change that behaviour, but design help might be needed -- because scoped coroutines are filtered on purpose -- in the dumps, in the text output etc., and in other places they are, on purpose, a single coroutine with their outer scope (so it's actually walkable with coroutine debugger/stackframe walker etc.).
Coroutine StandaloneCoroutine{Active}@1500b2f3, state: SUSPENDED
at DebugProbesContextKt$main$1$1$1$1.invokeSuspend(DebugProbesContext.kt:24)
at [CoroutineName(A inner), DispatchedCoroutine{Active}@93a07fa, Dispatchers.Default.limitedParallelism(1)].(DebugProbesContext.kt:21)
at DebugProbesContextKt$main$1$1$1.invokeSuspend(DebugProbesContext.kt:21)
at [CoroutineName(A), DispatchedCoroutine{Active}@78d14e01, Dispatchers.IO].(DebugProbesContext.kt:19)
at DebugProbesContextKt$main$1$1.invokeSuspend(DebugProbesContext.kt:19)kotlin.Unit
Reproducer:
Outputs:
Note that the debug info for the second coroutine does not show the effect of withContext switch.
This is likely because
kotlinx.coroutines.debug.internal.DebugCoroutineInfoImpl
has immutable context and it is not updated from theframe
inupdateState
.The issue occasionally shows up in problem investigations, wrong context in the debug probes causes confusion.
The text was updated successfully, but these errors were encountered: