-
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
StackOverflow in DispatchedContinuation #2371
Comments
Update: Happens 100% on Xiaomi android phones with Android 8. |
I cannot reproduce it, but I've fixed StackOverflow in |
Unfrotunately I cannot reproduce this bug either - I do not have Xiaomi phone with Android 8 on hand. I will let you know, if/when I get access to proper test device - perhaps tomorrow. So far we are rolling coroutines version back to 1.39. Changes in linked PR look promising. |
@elizarov Just had a relatively similar stack trace via Google Play Pre Launch reports According to console it occured on their Motorola Moto E5 (pettyl) - Android 8.1 test device.
|
Same problem, Lenovo X2, Android 5.0, coroutines 1.4.1:
|
I have build our app with |
I have a 100% reproducible case on a Samsung Galaxy S20+ running Android 10, with coroutines 1.4.1. The stacktrace looks about the same as the others:
I built our project using the |
Thanks for the confirmation. Now, the last remaining problem is to figure out how it happens so we can actually add test together with a fix. |
After checking all logs seems the code that caused that for me was a simple
Running in : |
Is there a lib hotfix planned for this fix? Maybe 1.4.2? |
Yes. It will a part of 1.4.2 |
Is there any information when the release comes? |
Also running into this issue, and wondering the timeline for the minor release |
waiting for 1.4.2 |
Should fix crashes on some devices. See Kotlin/kotlinx.coroutines#2371 (cherry picked from commit 8bf1cf3)
I can still reproduce it on version 1.4.2
|
@orab I see how it can be fixed, but I'm totally puzzled at how you've managed to reproduce it. What kind of code could even trigger printing such an object to a string? How did you even manage to get hold of it? |
@elizarov This problem is happened on Android, and I found it could be reproduced only if I use In Android's final Printer logging = me.mLogging;
if (logging != null) {
logging.println(">>>>> Dispatching to " + msg.target + " " + msg.callback + ": " + msg.what);
} type of I think it may be the source of |
…port (#5313) ## Explanation Fixes part of #5312 Fixes part of #59 This PR helps prepare for changes coming in #5315 and #4929 (the latter of which is the start of the main upcoming Bazel migration PR chain) by introducing one main scripts-based change: ``ScriptBackgroundCoroutineDispatcher``: a Kotlin coroutine dispatcher for executing asynchronous tasks in scripts that also supports proper Java executor service shutdown (so that scripts don't hang). This dispatcher is multi-threaded to help simplify executing large numbers of parallel background tasks. All scripts have been migrated over to running their primary operations within the context of this new dispatcher. Relevant script utilities have been updated to use it, including ``CommandExecutor`` (though this is mainly a placeholder change for the main executor changes which are coming in #4929). Miscellaneous details to note: 1. A bunch of 'e.g.' typos were fixed in ``GenerateMavenDependenciesList.kt`` and ``wiki/Updating-Maven-Dependencies.md``. These aren't functionally needed, they were just something I noticed while developing. 2. ``kotlinx-coroutines-core`` was updated from 1.4.1 to 1.4.3 in order to work around Kotlin/kotlinx.coroutines#2371 which was causing flakiness in one of the new dispatcher tests. 3. ``testClose_pendingTaskLongerThanCloseTimeout_taskIsNotRun`` intentionally takes ~2 seconds to run in order to provide some assurance that, without cancellation, the task _would_ run and the test _would_ fail (this has been manually verified in a few different situations of the dispatcher and/or test changing; some changes won't result in a failure due to how cancellation works internally for executor service & the converted coroutine dispatcher). Note that historically these changes were originally part of #4929, but they were split out so that they could be used by #5315 (which ended up being convenient to include prior to #4929). ## Essential Checklist - [x] The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".) - [x] Any changes to [scripts/assets](https://github.com/oppia/oppia-android/tree/develop/scripts/assets) files have their rationale included in the PR explanation. - [x] The PR follows the [style guide](https://github.com/oppia/oppia-android/wiki/Coding-style-guide). - [x] The PR does not contain any unnecessary code changes from Android Studio ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#undo-unnecessary-changes)). - [x] The PR is made from a branch that's **not** called "develop" and is up-to-date with "develop". - [x] The PR is **assigned** to the appropriate reviewers ([reference](https://github.com/oppia/oppia-android/wiki/Guidance-on-submitting-a-PR#clarification-regarding-assignees-and-reviewers-section)). ## For UI-specific PRs only This PR doesn't include any user-facing changes since it only impacts scripts. --------- Co-authored-by: Adhiambo Peres <59600948+adhiamboperes@users.noreply.github.com>
We are having a a bug in a class used to instantiate heavy objects in background thread. Seems to happen since bumping coroutines to 1.4.0. Looks like something is cycling in an endless loop.
A class:
Stack trace:
Fatal Exception: r4.a.i0: Fatal exception in coroutines machinery for DispatchedContinuation[Dispatchers.Default, Continuation at **.AsyncSingletonContainer$cachedSingletonObject$1.invokeSuspend(AsyncSingletonContainer.kt)@f734c38]. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
at kotlinx.coroutines.DispatchedTask.handleFatalException$kotlinx_coroutines_core(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:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.java:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:665)
Caused by java.lang.StackOverflowError: stack size 1037KB
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:452)
at java.lang.StringBuilder.append(StringBuilder.java:137)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.DisposeOnCancel.toString(DisposeOnCancel.java:385)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CompletedContinuation.toString(CompletedContinuation.java:18)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.DisposeOnCancel.toString(DisposeOnCancel.java:385)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CompletedContinuation.toString(CompletedContinuation.java:18)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.DisposeOnCancel.toString(DisposeOnCancel.java:385)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CompletedContinuation.toString(CompletedContinuation.java:18)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.DisposeOnCancel.toString(DisposeOnCancel.java:385)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CompletedContinuation.toString(CompletedContinuation.java:18)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.DisposeOnCancel.toString(DisposeOnCancel.java:385)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CompletedContinuation.toString(CompletedContinuation.java:18)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.DisposeOnCancel.toString(DisposeOnCancel.java:385)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CompletedContinuation.toString(CompletedContinuation.java:18)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.DisposeOnCancel.toString(DisposeOnCancel.java:385)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CompletedContinuation.toString(CompletedContinuation.java:18)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.DisposeOnCancel.toString(DisposeOnCancel.java:385)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CompletedContinuation.toString(CompletedContinuation.java:18)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.DisposeOnCancel.toString(DisposeOnCancel.java:385)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CompletedContinuation.toString(CompletedContinuation.java:18)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.DisposeOnCancel.toString(DisposeOnCancel.java:385)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CompletedContinuation.toString(CompletedContinuation.java:18)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.CancellableContinuationImpl.toString(CancellableContinuationImpl.java:506)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.ResumeAwaitOnCompletion.toString(ResumeAwaitOnCompletion.java:1414)
at java.lang.String.valueOf(String.java:2827)
at java.lang.StringBuilder.append(StringBuilder.java:132)
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.java:320)
at kotlinx.coroutines.JobSupport.tryFinalizeSimpleState(JobSupport.java:295)
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.java:853)
at kotlinx.coroutines.JobSupport.makeCompletingOnce$kotlinx_coroutines_core(JobSupport.java:825)
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:106)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:571)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.java:738)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.java:678)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:665)
The text was updated successfully, but these errors were encountered: