Skip to content
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

Very long 'Processing' dialog if AutoSync is enabled and AnkiWeb is down. ANR if no notification permissions #17551

Open
david-allison opened this issue Dec 5, 2024 · 3 comments
Labels
2.19 Help Wanted Requesting Pull Requests from volunteers Priority-High Sync

Comments

@david-allison
Copy link
Member

david-allison commented Dec 5, 2024

  • Enable autosync
  • Open AnkiDroid when AnkiWeb is down
  • "Processing" dialog can't be cancelled and took ~15 second to close
    • Maybe longer, AnkiWeb was back up by the time it completed

A user reported that the app was hung, this may be related

Reproduction patch:

Index: AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt b/AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt
--- a/AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt	(revision 951615f7753ca8b5710f15cce2bba2a9a114f91c)
+++ b/AnkiDroid/src/main/java/com/ichi2/anki/Sync.kt	(date 1733378352598)
@@ -23,6 +23,7 @@
 import androidx.annotation.StringRes
 import androidx.appcompat.app.AlertDialog
 import androidx.core.content.edit
+import anki.backend.backendError
 import anki.sync.SyncAuth
 import anki.sync.SyncCollectionResponse
 import anki.sync.syncAuth
@@ -50,6 +51,7 @@
 import kotlinx.coroutines.withContext
 import net.ankiweb.rsdroid.Backend
 import net.ankiweb.rsdroid.exceptions.BackendInterruptedException
+import net.ankiweb.rsdroid.exceptions.BackendNetworkException
 import net.ankiweb.rsdroid.exceptions.BackendSyncException
 import timber.log.Timber
 
@@ -223,6 +225,12 @@
         manualCancelButton = R.string.dialog_cancel
     ) {
         withCol {
+            Timber.d("Simulating AnkiWeb wait")
+            Thread.sleep(10_000)
+            Timber.d("Simulating AnkiWeb timeout error")
+            throw BackendNetworkException(backendError {
+                message = "testing timeout"
+            })
             syncCollection(auth2, media = false) // media is synced by SyncMediaWorker
         }
     }
@david-allison david-allison added this to the 2.20.1 release milestone Dec 5, 2024
@david-allison david-allison added Needs Triage Help Wanted Requesting Pull Requests from volunteers Priority-High and removed Needs Triage labels Dec 5, 2024
@david-allison
Copy link
Member Author

This is caused by:

  • loadDeckCounts takes > 600ms
  • sync attempts to display a dialog
  • The loadDeckCounts dialog takes priority, and the cancellable sync dialog is not shown
  • Therefore Sync is not cancellable and needs to wait for a timeout on AnkiWeb

This causes an ANR if notifications are not disabled

Logcat with custom logs in various places

05:09:40.271 AnkiDroid               com.ichi2.anki.debug                 D  Startup - Application Start
05:09:40.272 AnkiDroidApp            com.ichi2.anki.debug                 I  Timber config: DEBUG
05:09:40.274 UsageAnalytics          com.ichi2.anki.debug                 I  initialize()
05:09:40.274 UsageAnalytics          com.ichi2.anki.debug                 D  App tracking id 'tid' = UA-125800786-1
05:09:40.284 chi2.anki.debug         com.ichi2.anki.debug                 W  Entry not found
05:09:40.285 nativeloader            com.ichi2.anki.debug                 D  Configuring clns-5 for other apk /data/app/~~A0crVgk928sOquObaeYy1w==/com.google.android.trichromelibrary_677803933-ju1lgS4jC7dWTOKfRkJTYw==/base.apk. target_sdk_version=34, uses_libraries=ALL, library_path=/data/app/~~QO6clns8gevb54Up-B-ecA==/com.google.android.webview-j5wmd2tABXwdK8NCi9WOAA==/lib/arm64:/data/app/~~QO6clns8gevb54Up-B-ecA==/com.google.android.webview-j5wmd2tABXwdK8NCi9WOAA==/base.apk!/lib/arm64-v8a:/data/app/~~A0crVgk928sOquObaeYy1w==/com.google.android.trichromelibrary_677803933-ju1lgS4jC7dWTOKfRkJTYw==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand
05:09:40.285 nativeloader            com.ichi2.anki.debug                 D  Extending system_exposed_libraries: libSDKRecognitionOCR.spenocr.samsung.so:libSDKMoireDetector.spenocr.samsung.so:libSDKonnxruntime.spenocr.samsung.so:libtensorflowlite_c.spenocr.samsung.so:libaudiomirroring_jni.audiomirroring.samsung.so:libSecEmbms.telephony.samsung.so:libSFEffect.fonteffect.samsung.so:libhumantracking.arcsoft.so:libPortraitDistortionCorrection.arcsoft.so:libPortraitDistortionCorrectionCali.arcsoft.so:libface_landmark.arcsoft.so:libFacialStickerEngine.arcsoft.so:libfrtracking_engine.arcsoft.so:libFaceRecognition.arcsoft.so:libveengine.arcsoft.so:lib_pet_detection.arcsoft.so:libhigh_res.arcsoft.so:libimage_enhancement.arcsoft.so:liblow_light_hdr.arcsoft.so:libhigh_dynamic_range.arcsoft.so:libsuperresolution.arcsoft.so:libobjectcapture_jni.arcsoft.so:libobjectcapture.arcsoft.so:libFacialAttributeDetection.arcsoft.so:libneural.snap.samsung.so:libsecuresnap_aidl.snap.samsung.so:libsnap_aidl.snap.samsung.so:libSEF.quram.so:libimagecodec.quram.so:libagifencoder.quram.so:libknox_remotedesktopclie
05:09:40.290 nativeloader            com.ichi2.anki.debug                 D  Configuring clns-6 for other apk /data/app/~~QO6clns8gevb54Up-B-ecA==/com.google.android.webview-j5wmd2tABXwdK8NCi9WOAA==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~QO6clns8gevb54Up-B-ecA==/com.google.android.webview-j5wmd2tABXwdK8NCi9WOAA==/lib/arm64:/data/app/~~QO6clns8gevb54Up-B-ecA==/com.google.android.webview-j5wmd2tABXwdK8NCi9WOAA==/base.apk!/lib/arm64-v8a:/data/app/~~A0crVgk928sOquObaeYy1w==/com.google.android.trichromelibrary_677803933-ju1lgS4jC7dWTOKfRkJTYw==/base.apk!/lib/arm64-v8a, permitted_path=/data:/mnt/expand
05:09:40.293 WebViewFactory          com.ichi2.anki.debug                 I  Loading com.google.android.webview version 131.0.6778.39 (code 677803933)
05:09:40.304 cr_WVCFactoryProvider   com.ichi2.anki.debug                 I  version=131.0.6778.39 (677803933) minSdkVersion=29 isBundle=true multiprocess=true packageId=2
05:09:40.323 chromium                com.ichi2.anki.debug                 I  [1205/050940.323232:INFO:variations_seed_loader.cc(68)] Failed to open file for reading.: No such file or directory (2)
05:09:40.324 cr_LibraryLoader        com.ichi2.anki.debug                 I  Successfully loaded native library
05:09:40.324 cr_CachingUmaRecorder   com.ichi2.anki.debug                 I  Flushed 6 samples from 6 histograms, 0 samples were dropped.
05:09:40.327 cr_CombinedPProvider    com.ichi2.anki.debug                 I  #registerProvider() provider:WV.y8@3c709ad isPolicyCacheEnabled:false policyProvidersSize:0
05:09:40.328 cr_PolicyProvider       com.ichi2.anki.debug                 I  #setManagerAndSource() 0
05:09:40.334 cr_CombinedPProvider    com.ichi2.anki.debug                 I  #linkNativeInternal() 1
05:09:40.334 Compatibil...geReporter com.ichi2.anki.debug                 D  Compat change id reported: 183155436; UID 10324; state: ENABLED
05:09:40.334 cr_AppResProvider       com.ichi2.anki.debug                 I  #getApplicationRestrictionsFromUserManager() Bundle[EMPTY_PARCEL]
05:09:40.334 cr_PolicyProvider       com.ichi2.anki.debug                 I  #notifySettingsAvailable() 0
05:09:40.335 cr_CombinedPProvider    com.ichi2.anki.debug                 I  #onSettingsAvailable() 0
05:09:40.335 cr_CombinedPProvider    com.ichi2.anki.debug                 I  #flushPolicies()
05:09:40.380 Compatibil...geReporter com.ichi2.anki.debug                 D  Compat change id reported: 214741472; UID 10324; state: ENABLED
05:09:40.407 GoogleAnalyticsImpl     com.ichi2.anki.debug                 I  Not participating in analytics sample (sample percentage vs random: 10 92)
05:09:40.408 UsageAnalytics          com.ichi2.anki.debug                 D  Chaining to uncaughtExceptionHandler (org.chromium.base.JavaExceptionReporter@440eb37)
05:09:40.408 UsageAnalytics          com.ichi2.anki.debug                 I  setOptIn(): from false to false
05:09:40.408 GoogleAnalyticsImpl     com.ichi2.anki.debug                 I  Not participating in analytics sample (sample percentage vs random: 10 91)
05:09:40.408 UsageAnalytics          com.ichi2.anki.debug                 D  setOptIn() optIn / sAnalytics.config().enabled(): false/false
05:09:40.409 UsageAnalytics          com.ichi2.anki.debug                 I  setDryRun(): true, warning dryRun is experimental
05:09:40.409 ThrowableFilterService  com.ichi2.anki.debug                 I  initialize()
05:09:40.409 ThrowableFilterService  com.ichi2.anki.debug                 D  Chaining to uncaughtExceptionHandler (com.ichi2.anki.analytics.UsageAnalytics$$ExternalSyntheticLambda1@6c9a60d)
05:09:40.418 TestUtilsKt             com.ichi2.anki.debug                 D  isRunningAsUnitTest: false
05:09:40.422 NotificationChannels    com.ichi2.anki.debug                 I  Creating notification channel with id/name: General Notifications/AnkiDroid
05:09:40.423 NotificationChannels    com.ichi2.anki.debug                 I  Creating notification channel with id/name: Synchronization/Synchronization
05:09:40.423 NotificationChannels    com.ichi2.anki.debug                 I  Creating notification channel with id/name: Global Reminders/Cards due
05:09:40.424 NotificationChannels    com.ichi2.anki.debug                 I  Creating notification channel with id/name: Deck Reminders/Reminders
05:09:40.443 AnkiDroidApp            com.ichi2.anki.debug                 I  AnkiDroidApp: Starting Services
05:09:40.444 BootService             com.ichi2.anki.debug                 W  BootService - unexpected action received, ignoring: null
05:09:40.447 TtsVoices               com.ichi2.anki.debug                 D  launching job
05:09:40.457 Compatibil...geReporter com.ichi2.anki.debug                 D  Compat change id reported: 247079863; UID 10324; state: ENABLED
05:09:40.457 TtsVoices$...LocalesJob com.ichi2.anki.debug                 D  executing job
05:09:40.459 TtsVoices               com.ichi2.anki.debug                 V  begin TTS creation
05:09:40.475 TextToSpeech            com.ichi2.anki.debug                 I  Sucessfully bound to com.google.android.tts
05:09:40.478 TextToSpeech            com.ichi2.anki.debug                 I  Connected to TTS engine
05:09:40.489 TextToSpeech            com.ichi2.anki.debug                 I  Setting up the connection to TTS engine...
05:09:40.493 AnkiDroidApp$onCreate   com.ichi2.anki.debug                 I  IntentHandler::onCreate
05:09:40.495 Themes                  com.ichi2.anki.debug                 I  Setting theme to BLACK
05:09:40.499 chi2.anki.debug         com.ichi2.anki.debug                 E  Invalid resource ID 0x00000000.
05:09:40.568 IntentHandler           com.ichi2.anki.debug                 V  Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.ichi2.anki.debug/com.ichi2.anki.IntentHandler bnds=[820,695][1026,1049] }
05:09:40.589 WM-PackageManagerHelper com.ichi2.anki.debug                 D  Skipping component enablement for androidx.work.impl.background.systemjob.SystemJobService
05:09:40.589 WM-Schedulers           com.ichi2.anki.debug                 D  Created SystemJobScheduler and enabled SystemJobService
05:09:40.592 WM-ForceStopRunnable    com.ichi2.anki.debug                 D  The default process name was not specified.
05:09:40.592 WM-ForceStopRunnable    com.ichi2.anki.debug                 D  Performing cleanup operations.
05:09:40.599 IntentHandler           com.ichi2.anki.debug                 D  onCreate() performing default action
05:09:40.599 IntentHandler           com.ichi2.anki.debug                 I  Launching DeckPicker
05:09:40.612 Compatibil...geReporter com.ichi2.anki.debug                 D  Compat change id reported: 160794467; UID 10324; state: ENABLED
05:09:40.616 WM-ForceStopRunnable    com.ichi2.anki.debug                 D  Application was force-stopped, rescheduling.
05:09:40.617 chi2.anki.debug         com.ichi2.anki.debug                 E  Invalid resource ID 0x00000000.
05:09:40.633 Compatibil...geReporter com.ichi2.anki.debug                 D  Compat change id reported: 171228096; UID 10324; state: ENABLED
05:09:40.647 ConnectivityManager     com.ichi2.anki.debug                 D  StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4402)] [android.net.ConnectivityManager.registerDefaultNetworkCallbackForUid(ConnectivityManager.java:4966)] [android.net.ConnectivityManager.registerDefaultNetworkCallback(ConnectivityManager.java:4933)] [WV.kE.e(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:44)] [WV.kE.b(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:1)] [org.chromium.android_webview.AwContentsLifecycleNotifier.onFirstWebViewCreated(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:19)] [J.N._J_J(Native Method)] [org.chromium.android_webview.AwContents.<init>(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:453)] [com.android.webview.chromium.l.run(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:148)] [WV.IY.b(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:20)] [WV.HY.run(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:3)] [org.chromium.base.task.PostTask.d(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:12)] [WV.IY.a(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:23)] [com.android.webview.chromium.WebViewChromiumFactoryProvider.a(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:3)] [com.android.webview.chromium.WebViewChromium.init(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:329)] [android.webkit.WebView.<init>(WebView.java:447)] [android.webkit.WebView.<init>(WebView.java:367)] [android.webkit.WebView.<init>(WebView.java:349)] [android.webkit.WebView.<init>(WebView.java:336)] [android.webkit.WebView.<init>(WebView.java:326)] [com.ichi2.utils.WebViewUtilsKt.getWebviewUserAgent(WebViewUtils.kt:57)] [com.ichi2.anki.servicelayer.DebugInfoService$getDebugInfo$webviewUserAgent$1.invokeSuspend(DebugInfoService.kt:40)] [kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)] [kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)]
05:09:40.650 ConnectivityManager     com.ichi2.anki.debug                 D  StackLog: [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4402)] [android.net.ConnectivityManager.sendRequestForNetwork(ConnectivityManager.java:4444)] [android.net.ConnectivityManager.registerNetworkCallback(ConnectivityManager.java:4826)] [WV.kE.e(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:93)] [WV.kE.b(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:1)] [org.chromium.android_webview.AwContentsLifecycleNotifier.onFirstWebViewCreated(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:19)] [J.N._J_J(Native Method)] [org.chromium.android_webview.AwContents.<init>(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:453)] [com.android.webview.chromium.l.run(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:148)] [WV.IY.b(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:20)] [WV.HY.run(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:3)] [org.chromium.base.task.PostTask.d(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:12)] [WV.IY.a(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:23)] [com.android.webview.chromium.WebViewChromiumFactoryProvider.a(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:3)] [com.android.webview.chromium.WebViewChromium.init(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:329)] [android.webkit.WebView.<init>(WebView.java:447)] [android.webkit.WebView.<init>(WebView.java:367)] [android.webkit.WebView.<init>(WebView.java:349)] [android.webkit.WebView.<init>(WebView.java:336)] [android.webkit.WebView.<init>(WebView.java:326)] [com.ichi2.utils.WebViewUtilsKt.getWebviewUserAgent(WebViewUtils.kt:57)] [com.ichi2.anki.servicelayer.DebugInfoService$getDebugInfo$webviewUserAgent$1.invokeSuspend(DebugInfoService.kt:40)] [kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)] [kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)]
05:09:40.665 WM-PackageManagerHelper com.ichi2.anki.debug                 D  Skipping component enablement for androidx.work.impl.background.systemalarm.RescheduleReceiver
05:09:40.666 TtsVoices$createTts     com.ichi2.anki.debug                 V  TTS creation success
05:09:40.668 Compatibil...geReporter com.ichi2.anki.debug                 D  Compat change id reported: 78294732; UID 10324; state: ENABLED
05:09:40.689 AnkiDroidApp$onCreate   com.ichi2.anki.debug                 I  AnkiDroid Version = 2.21alpha0-debug (e594ff5f34d6c9ef4c28ca3b33b6e72fa0bd4215)
                                                                             
                                                                             Backend Version = 0.1.48-anki24.11 (24.11 c47638ca36f99dd4f3b81ae82d964aec66e392e0)
                                                                             
                                                                             Android Version = 14 (SDK 34)
                                                                             
                                                                             ProductFlavor = play
                                                                             
                                                                             Manufacturer = samsung
                                                                             
                                                                             Model = SM-G991B
                                                                             
                                                                             Hardware = exynos2100
                                                                             
                                                                             Webview User Agent = Mozilla/5.0 (Linux; Android 14; SM-G991B Build/UP1A.231005.007; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/131.0.6778.39 Mobile Safari/537.36
                                                                             
                                                                             ACRA UUID = e4694be7-a482-41f6-bf29-8dab4eec7e41
                                                                             
                                                                             FSRS = 1.4.3 (Enabled: null)
                                                                             
                                                                             Crash Reports Enabled = false
05:09:40.733 Themes                  com.ichi2.anki.debug                 I  Setting theme to BLACK
05:09:40.742 AnkiDroidApp$onCreate   com.ichi2.anki.debug                 I  DeckPicker::onCreate
05:09:40.744 DeckPicker              com.ichi2.anki.debug                 D  Not displaying app intro
05:09:40.813 Compatibil...geReporter com.ichi2.anki.debug                 D  Compat change id reported: 210923482; UID 10324; state: ENABLED
05:09:40.973 chi2.anki.debug         com.ichi2.anki.debug                 W  Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (unsupported, reflection, allowed)
05:09:40.983 Compatibil...geReporter com.ichi2.anki.debug                 D  Compat change id reported: 149924527; UID 10324; state: ENABLED
05:09:40.983 Compatibil...geReporter com.ichi2.anki.debug                 D  Compat change id reported: 132649864; UID 10324; state: DISABLED
05:09:40.985 DeckPicker              com.ichi2.anki.debug                 D  handleStartup: Continuing after permission granted
05:09:41.004 Backend                 com.ichi2.anki.debug                 D  Opening rust backend with lang=[en-GB]
05:09:41.011 rsdroid::logging        com.ichi2.anki.debug                 I  rsdroid logging enabled
05:09:41.023 Media                   com.ichi2.anki.debug                 V  dir /storage/emulated/0/Android/data/com.ichi2.anki.debug/files/AnkiDroid/collection.media
05:09:41.024 Collection              com.ichi2.anki.debug                 I  (Re)opening Database: /storage/emulated/0/Android/data/com.ichi2.anki.debug/files/AnkiDroid/collection.anki2
05:09:41.046 InitialActivity         com.ichi2.anki.debug                 D  Not a fresh install [preferences]
05:09:41.047 DeckPicker              com.ichi2.anki.debug                 I  No startup screens required
05:09:41.067 ScopedStorageService    com.ichi2.anki.debug                 I  isLegacyStorage(): current dir: /storage/emulated/0/Android/data/com.ichi2.anki.debug/files/AnkiDroid
                                                                             scoped external dirs: /storage/emulated/0/Android/data/com.ichi2.anki.debug/files
                                                                             scoped internal dir: /data/user/0/com.ichi2.anki.debug/files
05:09:41.067 ScopedStorageService    com.ichi2.anki.debug                 I  isLegacyStorage(): false
05:09:41.074 DeckPicker              com.ichi2.anki.debug                 D  No DeckPicker background preference
05:09:41.094 WebViewUtilsKt          com.ichi2.anki.debug                 D  WebView is up to date. com.google.android.webview: 131.0.6778.39(677803933)
05:09:41.095 cr_media                com.ichi2.anki.debug                 W  BLUETOOTH_CONNECT permission is missing.
05:09:41.096 cr_media                com.ichi2.anki.debug                 W  getBluetoothAdapter() requires BLUETOOTH permission
05:09:41.096 cr_media                com.ichi2.anki.debug                 W  registerBluetoothIntentsIfNeeded: Requires BLUETOOTH permission
05:09:41.100 AnkiDroidApp$onCreate   com.ichi2.anki.debug                 I  DeckPicker::onStart
05:09:41.118 AnkiDroidApp$onCreate   com.ichi2.anki.debug                 I  DeckPicker::onResume
05:09:41.119 UsageAnalytics          com.ichi2.anki.debug                 D  sendAnalyticsScreenView(): DeckPicker
05:09:41.119 UsageAnalytics          com.ichi2.anki.debug                 D  getOptIn() status: false
05:09:41.124 DeckPicker              com.ichi2.anki.debug                 D  updateDeckList
05:09:41.126 Dialog                  com.ichi2.anki.debug                 I  mIsDeviceDefault = false, mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
05:09:41.129 DeckPicker...teDeckList com.ichi2.anki.debug                 D  Refreshing deck list
05:09:41.134 Compatibil...geReporter com.ichi2.anki.debug                 D  Compat change id reported: 237531167; UID 10324; state: DISABLED
05:09:41.156 DeckPicker              com.ichi2.anki.debug                 I  autoSync: starting foreground
05:09:41.160 chromium                com.ichi2.anki.debug                 W  [WARNING:viz_main_impl.cc(85)] VizNullHypothesis is disabled (not a warning)
05:09:41.160 SyncKt                  com.ichi2.anki.debug                 I  Sync: Normal collection sync
05:09:41.161 Dialog                  com.ichi2.anki.debug                 I  mIsDeviceDefault = false, mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
05:09:41.171 anki::sync::collectio.. com.ichi2.anki.debug                 D  fetching meta...
05:09:41.172 DeckPicker...teDeckList com.ichi2.anki.debug                 D  load deck counts: completed `col` access
05:09:41.172 DeckPicker              com.ichi2.anki.debug                 I  Updating deck list UI
05:09:41.177 DeckAdapter             com.ichi2.anki.debug                 D  buildDeckList
05:09:41.181 DeckPicker              com.ichi2.anki.debug                 D  Startup - Deck List UI Completed
05:09:41.279 chi2.anki.debug         com.ichi2.anki.debug                 I  Compiler allocated 7198KB to compile void android.view.ViewRootImpl.performTraversals()
05:09:41.333 DeckPicker              com.ichi2.anki.debug                 D  onCreateOptionsMenu()
05:09:41.447 AnkiDroidApp$onCreate   com.ichi2.anki.debug                 I  IntentHandler::onDestroy
05:09:41.520 TtsVoices$...LocalesJob com.ichi2.anki.debug                 D  80 TTS Voices available
05:09:41.522 TextToSpeech            com.ichi2.anki.debug                 I  Disconnected from TTS engine
05:09:41.732 CoroutineH...$dialogJob com.ichi2.anki.debug                 I  Displaying progress dialog: 600ms elapsed; cancellable: false; manualCancel: false
05:09:41.813 Settings                com.ichi2.anki.debug                 W  Setting show_button_background has moved from android.provider.Settings.System to android.provider.Settings.Global, returning read-only value.
05:09:41.817 WindowManager           com.ichi2.anki.debug                 I  WindowManagerGlobal#addView, ty=2, view=DecorView@c5bf5aa[DeckPicker], caller=android.view.WindowManagerImpl.addView:150 android.app.Dialog.show:512 com.ichi2.anki.CoroutineHelpersKt$withProgressDialog$2$dialogJob$1.invokeSuspend:408 
05:09:41.828 CoroutineH...$dialogJob com.ichi2.anki.debug                 W  A progress dialog is already displayed, not displaying progress dialog: true; manualCancel: true
05:09:42.011 rsdroid::logging        com.ichi2.anki.debug                 D  STDOUT: [WARNING:viz_main_impl.cc(85)] VizNullHypothesis is disabled (not a warning)
05:09:49.928 chi2.anki.debug         com.ichi2.anki.debug                 W  Cleared Reference was only reachable from finalizer (only reported once)
05:09:49.944 chi2.anki.debug         com.ichi2.anki.debug                 W  ApkAssets: Deleting an ApkAssets object '<empty> and /data/app/~~QO6clns8gevb54Up-B-ecA==/com.google.android.webview-j5wmd2tABXwdK8NCi9WOAA==/base.apk' with 1 weak references
05:09:49.944 chi2.anki.debug         com.ichi2.anki.debug                 W  ApkAssets: Deleting an ApkAssets object '<empty> and /data/app/~~QO6clns8gevb54Up-B-ecA==/com.google.android.webview-j5wmd2tABXwdK8NCi9WOAA==/split_config.en.apk' with 1 weak references
05:09:49.944 chi2.anki.debug         com.ichi2.anki.debug                 W  ApkAssets: Deleting an ApkAssets object '<empty> and /data/app/~~Z730Gs8BO_kBlvFLCwdGJQ==/com.google.android.tts-rMS8icHdglrDKzjo-NrDWw==/base.apk' with 1 weak references
05:09:49.946 ConnectivityManager     com.ichi2.anki.debug                 D  StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:5076)] [WV.lE.h(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:17)] [WV.n8.a(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:3)] [org.chromium.android_webview.AwContentsLifecycleNotifier.onLastWebViewDestroyed(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:19)] [J.N._V_J(Native Method)] [WV.A6.run(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:4)] [WV.Qd.handleMessage(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:91)] [WV.Sd.a(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:25)] [WV.A6.run(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:42)] [WV.Qd.handleMessage(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:55)]
05:09:49.948 ConnectivityManager     com.ichi2.anki.debug                 D  StackLog: [android.net.ConnectivityManager.unregisterNetworkCallback(ConnectivityManager.java:5076)] [WV.lE.h(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:26)] [WV.n8.a(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:3)] [org.chromium.android_webview.AwContentsLifecycleNotifier.onLastWebViewDestroyed(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:19)] [J.N._V_J(Native Method)] [WV.A6.run(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:4)] [WV.Qd.handleMessage(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:91)] [WV.Sd.a(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:25)] [WV.A6.run(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:42)] [WV.Qd.handleMessage(chromium-TrichromeWebViewGoogle6432.aab-stable-677803933:55)]
05:10:11.191 CoroutineH...ressDialog com.ichi2.anki.debug                 D  exception in withProgressDialog
                                                                             net.ankiweb.rsdroid.exceptions.BackendNetworkException: Connection timed out. Please try again. If you see frequent timeouts, please try a different network connection.
                                                                             
                                                                             Error details: ⁨⁩
                                                                             	at net.ankiweb.rsdroid.BackendException$Companion.fromError(BackendException.kt:117)
                                                                             	at net.ankiweb.rsdroid.BackendKt.unpackResult(Backend.kt:281)
                                                                             	at net.ankiweb.rsdroid.BackendKt.access$unpackResult(Backend.kt:1)
                                                                             	at net.ankiweb.rsdroid.Backend.runMethodRaw$lambda$1(Backend.kt:118)
                                                                             	at net.ankiweb.rsdroid.Backend.$r8$lambda$rLALQVYPlbbEmpwIB7kwMA6SO_U(Unknown Source:0)
                                                                             	at net.ankiweb.rsdroid.Backend$$ExternalSyntheticLambda2.invoke(D8$$SyntheticClass:0)
                                                                             	at net.ankiweb.rsdroid.Backend.withBackend(Backend.kt:131)
                                                                             	at net.ankiweb.rsdroid.Backend.runMethodRaw(Backend.kt:117)
                                                                             	at anki.backend.GeneratedBackend.syncCollectionRaw(GeneratedBackend.kt:71)
                                                                             	at anki.backend.GeneratedBackend.syncCollection(GeneratedBackend.kt:77)
                                                                             	at com.ichi2.libanki.SyncKt.syncCollection(Sync.kt:37)
                                                                             	at com.ichi2.anki.SyncKt$handleNormalSync$output$3.invokeSuspend$lambda$0(Sync.kt:227)
                                                                             	at com.ichi2.anki.SyncKt$handleNormalSync$output$3.$r8$lambda$D40lNNZfROcZ6Q2nmrvdq0ncimc(Unknown Source:0)
                                                                             	at com.ichi2.anki.SyncKt$handleNormalSync$output$3$$ExternalSyntheticLambda1.invoke(D8$$SyntheticClass:0)
                                                                             	at com.ichi2.anki.CollectionManager.withCol$lambda$1(CollectionManager.kt:119)
                                                                             	at com.ichi2.anki.CollectionManager.$r8$lambda$ffr4nUlMOyAvThaKA2WuJlnLaPU(Unknown Source:0)
                                                                             	at com.ichi2.anki.CollectionManager$$ExternalSyntheticLambda9.invoke(D8$$SyntheticClass:0)
                                                                             	at com.ichi2.anki.CollectionManager$withQueue$3.invokeSuspend(CollectionManager.kt:103)
                                                                             	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                             	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
                                                                             	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:111)
                                                                             	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
                                                                             	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
                                                                             	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
                                                                             	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
                                                                             	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)
05:10:11.193 CoroutineHelpersKt      com.ichi2.anki.debug                 I  Showing error dialog but not sending a crash report.
05:10:11.193 CoroutineHelpersKt      com.ichi2.anki.debug                 I  Error dialog displayed
05:10:11.198 Dialog                  com.ichi2.anki.debug                 I  mIsDeviceDefault = false, mIsSamsungBasicInteraction = false, isMetaDataInActivity = false
05:10:11.273 WindowManager           com.ichi2.anki.debug                 I  WindowManagerGlobal#addView, ty=2, view=DecorView@9545c6a[DeckPicker], caller=android.view.WindowManagerImpl.addView:150 android.app.Dialog.show:512 androidx.appcompat.app.AlertDialog$Builder.show:1008 
05:10:11.286 DeckAdapter$DeckFilter  com.ichi2.anki.debug                 I  deck filter: 1 (null)
05:10:11.289 CoroutineH...ressDialog com.ichi2.anki.debug                 D  withProgressDialog: success
05:10:11.289 WindowManager           com.ichi2.anki.debug                 I  WindowManagerGlobal#removeView, ty=2, view=DecorView@c5bf5aa[DeckPicker], caller=android.view.WindowManagerGlobal.removeView:628 android.view.WindowManagerImpl.removeViewImmediate:208 android.app.Dialog.dismissDialog:801 
05:10:11.377 BadgeDrawableBuilder    com.ichi2.anki.debug                 D  Adding badge
05:10:39.783 AnkiDroidApp$onCreate   com.ichi2.anki.debug                 I  DeckPicker::onPause
05:10:39.873 AnkiDroidApp$onCreate   com.ichi2.anki.debug                 I  DeckPicker::onStop
05:10:39.878 WidgetStatus            com.ichi2.anki.debug                 D  WidgetStatus.update(): already running or not enabled
05:10:39.887 AnkiDroidApp$onCreate   com.ichi2.anki.debug                 I  DeckPicker::onSaveInstanceState
05:10:39.894 InputManagerGlobal      com.ichi2.anki.debug                 D  setPointerIconType iconId = 1, callingPid = 22422

@david-allison david-allison changed the title Very long 'Processing' dialog if AutoSync is enabled and AnkiWeb is down Very long 'Processing' dialog if AutoSync is enabled and AnkiWeb is down. ANR if no notification permissions Dec 5, 2024
@david-allison
Copy link
Member Author

Cause: me. I couldn't reproduce the bug and the code was admittedly sloppy at the time

// TODO: This is a lazy hack to fix a bug. We hold the lock for far too long
// and do I/O inside it. Better to calculate the new lists outside the lock, then swap
mutex.withLock {
deckTree = node
hasSubdecks = node.children.any { it.children.any() }
currentDeckId = withCol { decks.current().optLong("id") }
rev = node.revCount
lrn = node.lrnCount
new = node.newCount
numbersComputed = true
// Filtering performs notifyDataSetChanged after the async work is complete
getFilter()?.filter(filter)
}

@david-allison david-allison added 2.19 and removed 2.20 labels Dec 5, 2024
@mikehardy
Copy link
Member

that explains why the ANRs I see are in get deck counts but sync is happening in the logcat I've seen
but it seems tied to notification permissions which is interesting, perhaps a multi-bug
This is definitely a big deal though, will affect people on slow or crappy networks as well (think, open anki on subway - well a US subway where wifi/cell is non-existent or crap) to do some reviews but no you're stuck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.19 Help Wanted Requesting Pull Requests from volunteers Priority-High Sync
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants