NeoApplications / Neo-Store

An F-Droid client with modern UI and an arsenal of extra features.
GNU General Public License v3.0
2.89k stars 90 forks source link

Installer crashes (when A/B system update reboot pending?) #383

Open opusforlife2 opened 1 year ago

opusforlife2 commented 1 year ago

The root installer has never crashed for me before. One day, while a system reboot was pending for an A/B OTA update, I tried to update an app. Neo Store crashed. Tried again, and same thing. A 3rd try gave the same crash as the 2nd.

I can only guess that the pending reboot blocked the installer from executing, because it would have changed the app version to something newer than what was copied to the inactive partition, and there was no way to change that.

Crash 1:

FATAL EXCEPTION: DefaultDispatcher-worker-18
Process: com.machiav3lli.fdroid, PID: 14059
java.lang.NoClassDefFoundError: <clinit> failed for class com.machiav3lli.fdroid.installer.RootInstaller; see exception in other thread
    at com.machiav3lli.fdroid.installer.AppInstaller$Companion$getInstance$1$1$1.getDefaultInstaller(AppInstaller.kt:39)
    at com.machiav3lli.fdroid.ui.fragments.AppSheetX$updateDownloadState$2.invokeSuspend(AppSheetX.kt:58)
    at com.machiav3lli.fdroid.ui.fragments.AppSheetX$updateDownloadState$2.invoke(AppSheetX.kt:13)
    at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:5)
    at kotlinx.coroutines.BuildersKt.withContext(Unknown Source:72)
    at com.machiav3lli.fdroid.ui.fragments.AppSheetX$downloadConnection$1$1$2.invokeSuspend(AppSheetX.kt:150)
    at com.machiav3lli.fdroid.ui.fragments.AppSheetX$downloadConnection$1$1$2.invoke(AppSheetX.kt:13)
    at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invokeSuspend(Merge.kt:44)
    at kotlinx.coroutines.flow.FlowKt__MergeKt$mapLatest$1.invoke(Merge.kt:18)
    at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invokeSuspend(Merge.kt:35)
    at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1$2.invoke(Merge.kt:13)
    at kotlinx.coroutines.AbstractCoroutine.start$enumunboxing$(AbstractCoroutine.kt:26)
    at kotlinx.coroutines.BuildersKt.launch$default(Unknown Source:35)
    at kotlinx.coroutines.flow.internal.ChannelFlowTransformLatest$flowCollect$3$1.emit(Merge.kt:102)
    at com.machiav3lli.fdroid.ui.fragments.AppSheetX$downloadConnection$1$1$invokeSuspend$$inlined$filter$1$2.emit(Emitters.kt:72)
    at kotlinx.coroutines.flow.SharedFlowImpl.collect$suspendImpl(SharedFlow.kt:188)
    at kotlinx.coroutines.flow.SharedFlowImpl$collect$1.invokeSuspend(Unknown Source:12)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:9)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:107)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:82)
    Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@2850c8f, Dispatchers.Default]
FATAL EXCEPTION: main
Process: com.machiav3lli.fdroid, PID: 14059
java.lang.ExceptionInInitializerError
    at com.machiav3lli.fdroid.installer.AppInstaller$Companion$getInstance$1$1$1.getDefaultInstaller(AppInstaller.kt:39)
    at com.machiav3lli.fdroid.service.DownloadService$publishSuccess$2.invokeSuspend(DownloadService.kt:54)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:9)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:107)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7870)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
    Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@2d3dfee, Dispatchers.Main]
Caused by: java.lang.IndexOutOfBoundsException: Index: 0
    at java.util.Collections$EmptyList.get(Collections.java:4511)
    at com.machiav3lli.fdroid.installer.RootInstaller.<clinit>(RootInstaller.kt:34)
    ... 12 more

Crash 2 (and 3):

FATAL EXCEPTION: main
Process: com.machiav3lli.fdroid, PID: 15884
java.lang.ExceptionInInitializerError
    at com.machiav3lli.fdroid.installer.AppInstaller$Companion$getInstance$1$1$1.getDefaultInstaller(AppInstaller.kt:39)
    at com.machiav3lli.fdroid.service.DownloadService$publishSuccess$2.invokeSuspend(DownloadService.kt:54)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:9)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:107)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7870)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
    Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@93c3789, Dispatchers.Main]
Caused by: java.lang.IndexOutOfBoundsException: Index: 0
    at java.util.Collections$EmptyList.get(Collections.java:4511)
    at com.machiav3lli.fdroid.installer.RootInstaller.<clinit>(RootInstaller.kt:34)
    ... 12 more
machiav3lli commented 1 year ago

Thanks for the report. I'll consider a solution for reporting this to users instead of crashing, as if it's truely the A/B-Update is the blocker, then there's nothing I can do to surpass it (using root installer, would maybe only make things more complicated).

opusforlife2 commented 1 year ago

Sorry, I completely forgot to mention: what increases my confidence in this reason is that I made sure that I did nothing else between trying the update and getting the crash, and then actually going ahead with the reboot. First thing after reboot, I tried the update and it worked.

machiav3lli commented 4 months ago

Can you please retest on 1.0.0, thanks!

opusforlife2 commented 4 months ago

Can I get an idea beforehand of what you ideally expect to happen?