kotlinx.coroutines: Exception in coroutines machinery (ClassCastException) affecting only few android 5 users
Kotlin 1.5.10, coroutines 1.4.3 (checked changelog - looks like not fixed) This is happening to 200 users (800 crashes) only on android 5 (I have at least 8000 android 5 users in last week.) Not reproducible.
Fatal Exception: kotlinx.coroutines.m0: Fatal exception in coroutines machinery for CancellableContinuation(DispatchedContinuation[Dispatchers.Default, Continuation at package.Repository$updateCacheVariants$1.invokeSuspend(Repository.kt)@2b36bba8]){Cancelled}@a821e66. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
at kotlinx.coroutines.DispatchedTask.handleFatalException(DispatchedTask.java:144)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:115)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.java:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.java:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:665)
Caused by java.lang.ClassCastException: kotlin.a0.k.a.c cannot be cast to kotlinx.coroutines.internal.e
at kotlinx.coroutines.CoroutineDispatcher.releaseInterceptedContinuation(CoroutineDispatcher.java:104)
at kotlin.coroutines.jvm.internal.ContinuationImpl.releaseIntercepted(ContinuationImpl.java:118)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:39)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:104)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.java:750)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.java:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:665)
While I’m investigating why stacktrace is obfuscated (Firebase should deobfuscate stacktraces automatically), reporting it now so you may have some feedback.
The code in referenced repository is as following
GlobalScope.launch {
try {
// generated retrofit suspend function and access property of response model
val response: List<Variants> = retrofitService.getAllVariants(request).variants
cachedVariants.saveVariantsToCache(response)
}
catch (e: Exception) {
logCouldntSaveCache()
}
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 24 (17 by maintainers)
@OliverO2 Can you comment in the YouTrack issue linked above? Ideally, you can also put a reproducing snippet there to help QA reproduce it.
Maybe this issue deserves an entry on YouTrack since it seems to be related to Kotlin 1.5.30? https://kotl.in/issue
@qwwdfsad I will try and see if I can create a sample app that has the same issue. However, once it boils down to what is actually crashing it would just be an app that includes Coroutines and calls a suspend function, i.e. like any other project. The project I work on doesn’t do anything special with Coroutines, just includes the library and then uses them.
However, when I get a chance I will try and create a small sample project.