-
Notifications
You must be signed in to change notification settings - Fork 1.9k
java.lang.ClassCastException: kotlin.coroutines.jvm.internal.CompletedContinuation cannot be cast to kotlinx.coroutines.internal.DispatchedContinuation #2736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
We still don't have reproducible case but all of our crashes happen in background. Is it same for everyone? |
It would be really helpful if anybody could provide a reproduced even if it's a set of espresso tests that fail 1 in 1000 times. |
Last 2 days we are working on reproducing but we had not luck. Only interesting thing is it only happens background according to firebase crashlytics. We are downgrading kotlin and coroutine. We don't have any reproducible case. We can try kotlin 1.5.20 when it is released. |
This issue looks similar to #2719. Is there any version of kotlin released with fix of https://youtrack.jetbrains.com/issue/KT-45685? |
The fix will be released with Kotlin 1.5.20-RC (~roughly next week) |
Still crashes with Kotlin 1.5.20-RC |
@auras Do you have reproducible case? And dont we need to have a coroutine release with 1.5.20 to test this issue again? |
Not reliably, no. But if I run the app/test I'm working on a few times it will happen. Usually during app launch. I thought since it was a kotlin issue, no coroutines release was required. |
@auras are these tests run on JVM or in an emulator? It could be some tricky race in |
@qwwdfsad running on both emulator and real devices I can provide apks but not source code |
Does it reproduce when running unit-tests locally, not on an emulator, but on plain JVM? |
I never saw it when running unit tests. We usually run those with TestCoroutineScope, runBlocking |
In our android app it crashes when using stateflow/sharedflow + debounce. So I was able to repro this with just launching ton of different coroutines which use stateflow+debounce.
Then I ran it's always (5 out 5 launches) crashing with the following stacktrace:
|
It's reproducible even without launching android app just by adding:
|
Kudos for the self-contained reproducer! It's hard to tell whether it is a root cause for |
@qwwdfsad it is, run it multiple times and sometimes it fails with exact classcastexception:
produces
in most of the runs (and it fails faster) |
Amazing! Looking into it |
Is there any release schedule how often is coroutines library released? This issue hit us very hard, so if we should choose path of building whole library by ourselves or try another fallback (older version, ...). Thanks |
I have the same issue with Kotlin 1.5.31 and kotlinx.coroutines 1.5.2
|
Reported a new issue #3005 |
Kotlin#2772) * Properly detect non-released reusable continuations in non-reusable ones and await for reusability to have a consistent state * Ensure that the caller to DispatchedContinuation.isReusable is reusable itself * Using the previous invariant, simplify DispatchedContinuation.isReusable to a single null-check * It also restores the invariant that `cc.isReusable() == cc.resumeMode.isReusableMode` Fixes Kotlin#2736 Fixes Kotlin#2768
kotlin version: 1.5.10
coroutines version: 1.5.0
I'm not sure how to reproduce, it sometimes happens during espresso tests
The text was updated successfully, but these errors were encountered: