-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
CoroutinesInternalError - Job is already complete or completing #1743
Comments
It's hard to tell what exactly is wrong. |
I am using combine to lazy load items, that are not available immidetaly and then kind of map these items to cartContent. Could the flatMapLatest be the cause of "is already complete or completing"? Fetching items
And then I am waiting for events from view to load items, something like this:
|
could you please clarify whether this problem is still reproducible on the latest version of coroutines? |
I have ditched the |
The same error happens to a few of our users on the version 1.3.4 as well. The problem that we are actively using flow and the crashlogs do not show any specific place which could throw this exception Fatal Exception: kotlinx.coroutines.CoroutinesInternalError: Fatal exception in coroutines machinery for DispatchedContinuation[Main [immediate], Continuation at kotlinx.coroutines.flow.internal.CombineKt$combineInternal$2.invokeSuspend(Combine.kt)@4470cff]. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
at kotlinx.coroutines.DispatchedTask.handleFatalException$kotlinx_coroutines_core(DispatchedTask.java:93)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:64)
at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.java:69)
at kotlinx.coroutines.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuationKt.java:321)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(CancellableKt.java:26)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.java:109)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.java:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(BuildersKt__Builders_commonKt.java:54)
at kotlinx.coroutines.BuildersKt.launch(BuildersKt.java:1)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(BuildersKt__Builders_commonKt.java:47)
at kotlinx.coroutines.BuildersKt.launch$default(BuildersKt.java:1)
at androidx.lifecycle.BlockRunner.maybeRun(BlockRunner.java:174) Caused by java.lang.IllegalStateException: Job ScopeCoroutine{Cancelled}@145a4a0 is already complete or completing, but is being completed with CompletedExceptionally[kotlinx.coroutines.JobCancellationException: ScopeCoroutine is cancelling; job=ScopeCoroutine{Cancelled}@145a4a0]
at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.java:828)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.java:111)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:46)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:55)
at kotlinx.coroutines.EventLoop.processUnconfinedEvent(EventLoop.java:69)
at kotlinx.coroutines.DispatchedContinuationKt.resumeCancellableWith(DispatchedContinuationKt.java:321)
at kotlinx.coroutines.intrinsics.CancellableKt.startCoroutineCancellable(CancellableKt.java:26)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.java:109)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.java:158)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch(BuildersKt__Builders_commonKt.java:54)
at kotlinx.coroutines.BuildersKt.launch(BuildersKt.java:1)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.launch$default(BuildersKt__Builders_commonKt.java:47)
at kotlinx.coroutines.BuildersKt.launch$default(BuildersKt.java:1) |
We are seeing the same crash on Android 7 with coroutines 1.3.3. I'm posting the full stack trace. The interesting thing is that the crash is probably triggered by OutOfMemoryException and it only happens on Android 7.0 and 7.1.
|
I have this issue on 1.3.6 version. My typical "combine" usage is something like this:
Sometimes "conflate" added to the source flows. And sometimes i use "collectLatest" instead of "collect" |
It seems to be a duplicate of #1683, and, to be more detailed, of vendor issue https://issuetracker.google.com/issues/145569946 It would be really nice if anyone could check the Unfortunately, we cannot even provide a "safer" mechanism as long as we cannot reproduce it locally. |
I was able to reproduce the issue on Meizu M6 (M711H). Unfortunately, I don't have this device now and can't verify the workaround above. |
I'm going to try this in the next release of our app. |
App is in production almost for a week and has not discussed crash after replacing combine(a, b) {} with a.combine(b) {}. |
Great! So the workaround is know, that's good. |
Although several device manufacturers are able to reproduce this issue, OPPO devices seem to be the most prevalent. Here is a screenshot of the reproducing OPPO devices from my Firebase Crashlytics dashboard: Where the stack trace is:
|
For a change of scenery, I'm not encountering this in Andoid but while testing a build produced by the new JS-IR compiler (code works fine in both JVM and legacy JS):
So far I'm having some trouble isolating or working around the issue (I don't use any |
FYI,
during setup : and then in tear up : |
Any news related to this issue? |
If anyone finds themselves here trying to fix a |
I have updated to the latest version of coroutines 1.3.3 and weird crash started popping in crashlytics. The weird thing is that all crashes are happening only on devices with Android 7.0 (about 5.5 % of users) and another common thing for these devices seems to be MediaTek SoC.
It seems to have someting to do with combine so I will look into that. Any help is appreciated
The text was updated successfully, but these errors were encountered: