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
### Reproducing scenario
For the following code:
```
suspend fun foo() = yield()
```
the following bytecode is produced:
```
fun foo(...) {
uCont.intercepted().dispatchUsingDispatcher() // 1
probeCoroutineSuspended() // 2
return COROUTINE_SUSPENDED // Unroll the stack
}
```
And it is possible to observe the next 'probeCoroutineSuspended' **prior** to receiving 'probeCoroutineSuspended'.
### Steps taken
To address this, a dedicated 'unmatchedResumes' field is introduced to the coroutine state, which keeps track of consecutive 'probeCoroutineResumed' without matching 'probeCoroutineSuspended' and attributes lately arrived probes to it.
Unfortunately, it introduces a much more unlikely race when **two** 'probeCoroutineSuspended' are reordered, then we misattribute 'lastObservedFrame', but it is still better than misattributing the actual coroutine state.
@volatile and @synchronized are also introduced to DebugCoroutineInfoImpl as previously they have been subject to data races as well
Fixes#3193
0 commit comments