Fenix: java.lang.IllegalThreadStateException at mozilla.components.feature.downloads.DownloadMiddleware$restoreDownloads$1$invokeSuspend$$inlined$collect$1.emit(Collect.kt:4)

Created on 30 Aug 2020  ·  22Comments  ·  Source: mozilla-mobile/fenix

Steps to reproduce

Just launch firefox.

Expected behavior

Should work smoothly.

Actual behavior

Crashes everytime.

Device information

  • Android device: Redmi K20 (Android 10)
  • Fenix version: 200830 06:01
Download crash engverified 🐞 bug

Most helpful comment

Thanks for the report, I'm taking a look. The issue should be only reproducible in nightly as the functionality is behind a feature flag. https://github.com/mozilla-mobile/fenix/blob/aae8236478d41df2adb0c23e662e2c35dedd90f5/app/src/main/java/org/mozilla/fenix/FenixApplication.kt#L167

All 22 comments

Can you still access the Settings? Then sharing the crash report via _Settings_, _About Firefox Nightly_, _Crashes_ and pressing _Share_ would be helpful here.

No. I can't even open the app. Here's a screen record for context.

Do you have Fenix as your default browser? Try setting another browser as your default browser.

No defaults have been set.

Ok, thanks :) Please use https://github.com/mozilla-mobile/fenix/wiki/Logging-Crash-Information#using-adb-logcat-to-get-crash-information to create a log for your crash, zip it up and attach it here. Also make sure to use adb logcat -c before reproducing the crash to clear anything else in the log. This will help the developers to find the cause for your crash.

https://crash-stats.mozilla.org/report/index/bp-aa3efb20-b3d5-4684-99ea-5b6a50200830

java.lang.IllegalThreadStateException: Expected `store` thread, but running on thread `DefaultDispatcher-worker-15`. Leaked MiddlewareContext?

java.lang.IllegalThreadStateException
    at mozilla.components.lib.state.internal.StoreThreadFactory.assertOnThread(StoreThreadFactory.kt:7)
    at mozilla.components.lib.state.internal.ReducerChainBuilder$build$threadCheck$1.invoke(ReducerChainBuilder.kt:3)
    at mozilla.components.lib.state.internal.ReducerChainBuilder$build$$inlined$forEach$lambda$1.invoke(ReducerChainBuilder.kt:3)
    at mozilla.components.lib.state.internal.ReducerChainBuilder$build$context$1.dispatch(ReducerChainBuilder.kt:1)
    at mozilla.components.feature.downloads.DownloadMiddleware$restoreDownloads$1$invokeSuspend$$inlined$collect$1.emit(Collect.kt:4)
    at mozilla.components.feature.downloads.DownloadStorage$getDownloads$$inlined$map$1$2.emit(Collect.kt:6)
    at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:1)
    at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:24)
    at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:1)
    at androidx.room.CoroutinesRoom$Companion$createFlow$1$1$1.invokeSuspend(CoroutinesRoom.kt:2)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:3)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:21)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:1)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:11)

Thanks! Since when do you have this issue, did it also occur on e.g. yesterday's Nightly?

I'm having the same issue since today. It's impossible to open Firefox nightly anymore. My log also looks the same

Device: Oneplus 6, Android 10
Screenshot_20200830-192028

Thanks! Since when do you have this issue, did it also occur on e.g. yesterday's Nightly?

No. It started happening after today's update.

cc @Amejia481 https://github.com/mozilla-mobile/fenix/commit/c63fd3f9ac2fd511cc4b7f791353d6ff4d412fcf and https://github.com/mozilla-mobile/android-components/pull/8197/files#diff-78ef6898bdea79d57a0d51a5c39104e4R98 - those commits might be the reason for these crashes

Thanks for the report, I'm taking a look. The issue should be only reproducible in nightly as the functionality is behind a feature flag. https://github.com/mozilla-mobile/fenix/blob/aae8236478d41df2adb0c23e662e2c35dedd90f5/app/src/main/java/org/mozilla/fenix/FenixApplication.kt#L167

Does it also crashes in the background? I mean when you are not even using the browser?

Yes

OK then I think I have the same bug. You can stop crashes in the background via settings -> apps -> firefox nightly and force stop, and don't open it until it's fixed

This happens to me too, and I think it's the same as #14505

This issue will be addressed after pr lands https://github.com/mozilla-mobile/android-components/pull/8293

STR

  1. Open Fenix download a file.
  2. Kill Fenix (Using the tasks manager).
  3. Reopen Fenix.

The issue should be fixed on master, and it will be fixed in the next update.

The issues seem to be fixed. The latest update don't crashes any more.

So there is already an update for it?

Hi, verified as fixed on the latest Nightly Build 200831 using the following devices:
• Google Pixel 3a (Android 10)
• Huawei Mate 20 Lite (Android 10)
• OnePlus A3 (Android 6.0.1)

► Video
20200831-123932

Was this page helpful?
0 / 5 - 0 ratings