ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.14k stars 2.17k forks source link

Random "Processing" popups #14873

Open user1823 opened 7 months ago

user1823 commented 7 months ago

While using the app, a popup saying "Processing" randomly appears on the screen.

I suspect this indicates that AnkiDroid is creating a backup. If it is so, either this should occur in the background (if possible) or the popup should clearly say "Creating a backup". Otherwise, it's not clear what it is "processing".

BrayanDSO commented 7 months ago

Idk if this is a 2.16 or 2.17 bug, but I have been experiencing this eventually since a reasonable amount of time

david-allison commented 7 months ago

A debug setting here would be useful: potentially either walk the stack, or accept a user-supplied debug string to display on the dialog

I suspect this is loadCounts, but we should be able to know the cause

david-allison commented 7 months ago

Lazy code which gets a good debug string

Exception().stackTraceToString().split("\n").reversed().takeWhile { !it.contains("launchCatchingTask") && !it.contains("withProgress") }.reversed().take(7).joinToString("\n")
dae commented 7 months ago

awaitBackupCompletion() can be moved out of withCol() and called via getBackend().awaitBackupCompletion() instead, which will prevent other collection ops from blocking while a backup completes.

user1823 commented 3 months ago

@david-allison, I still see random popups appearing on the screen for a fraction of second (for such a small amount of time that I can only see a flash). Today, I noticed that there is a backup created at the same time. So, I think that these popups are due to automated backups.

AnkiDroid version 2.18 alpha 6

user1823 commented 2 weeks ago

Recently (most probably since 2.19 alpha 6), the frequency of the "Processing" popups has increased. A popup appears almost every time I launch the app. These popups don't seem to be associated with automated backups because there is no backup created at the same time.

user1823 commented 2 weeks ago

With alpha 6, I am using the old directory location (/storage/emulated/0/AnkiDroid) because I had to uninstall and then reinstall the app after I installed alpha 5 which had a bug making it impossible to launch.

Can the recent increase in the frequency of these popups be caused by a shift from the new location (/storage/emulated/0/Android/data/com.ichi2.anki/files/AnkiDroid) to the old location?

In http://github.com/ankidroid/Anki-Android/wiki/Storage-Migration-FAQ, I read

If AnkiDroid 2.16 is using the new location ... file operations (media sync, import etc...) are much faster

So, maybe, the slow reading of the collection file from the old location is causing these "Processing" popups to appear?

Edit: I switched back to the new directory location and I am still seeing the problem. So, the directory location was not the cause.