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

AnkiDroid fails to sync when there is a card with due > 1000000000 [or some other unknown reason] #5728

Closed
Ekleog opened this issue Jan 23, 2020 · 12 comments
Labels

Comments

@Ekleog
Copy link
Contributor

Ekleog commented Jan 23, 2020

It looks like when there are cards with a too high due value (I had stuff with due > 1.500.000.000, no idea how it came to be in the first place, despite the fact I've been using anki{,droid} for years and have maybe 100-200k cards total it's still several orders of magnitude more), ankidroid refuses to sync changes, and states that the database is corrupt.

It's been happening to me even after full syncs, as well as after a reinstall and removal of the AnkiDroid folder, with just the sync parameters set, so not related to configuration I think.

The issue vanished at the time I used reposition on anki on all is:new cards that were not filtered, and then forced a full sync. As “Check Database” on anki had raised the “too big due values”, I assume that's likely the reason why ankidroid failed to sync.

I'm on the current f-droid version, which appears to be 2.9.1.

(Sorry for the tone as well as for not following the template, it's late and I have an exam tomorrow -- hopefully all the information needed is here, otherwise please feel free to close!)

Anyway, thank you as always for ankidroid, it's along with anki one of the best pieces of software I'm using, I think!
Cheers to you, and if someone is around paris someday, I really have to buy y'all a drink or something!

@Ekleog
Copy link
Contributor Author

Ekleog commented Jan 24, 2020

Nevermind. Looks like there's something else.

I have just:

  • re-filled all my filtered decks on ankidroid, it worked
  • synced from ankidroid, it worked
  • synced from anki, it worked
  • synced from ankidroid, it's giving me the local|remote choice again

Well, I'm just going to review without rescheduling on ankidroid until tomorrow, and will attempt to work more with you to attempt to debug that issue later on. If there's anything I can do to help (eg. provide the full deck in private message to someone, as it contains vocabulary I don't own the copyright of), feel free to tell me what and how!

@Ekleog Ekleog changed the title AnkiDroid fails to sync when there is a card with due > 1000000000 AnkiDroid fails to sync when there is a card with due > 1000000000 [or some other unknown reason] Jan 24, 2020
@mikehardy
Copy link
Member

Hey @Ekleog this may be related to your previous PR, check this issue out #5666 - but the triage there was inconclusive. There does appear to be something going on, but we're just not sure what yet?

@Ekleog
Copy link
Contributor Author

Ekleog commented Jan 26, 2020

Hey @mikehardy, thank you for your answer! I'm not sure about a relationship with the PR I sent through as, as far as I understood the code, it was supposed to touch only the displayed number -- but then, I totally might have been wrong.

As an additional data point: if I try to upload from ankidroid when it's giving me the local|remote, it freezes for a while on “Checking file before upload...”, then eventually fails without further error message (though I've just left the phone unattended for 30 minutes, so maybe there was a transient error message I couldn't read).

Also, I've heard of a friend who also from time to time has an issue with similar symptoms, and after a few days it self-resolves -- not sure at all whether that's related, though, nor whether there may not have been another reason for that failure, for they're not particularly proficient with computers. The “it self-resolves” part of it would make me guess it might be linked with an error on the server side, but it can also be a red herring, and the fix can also come from doing additional reviews, maybe.

As I'm at a loss about how to debug this further, having done basically no android app development yet (apart from said PR, which I did “blindly”), maybe I could send you my .colpkg by email or similar, so that you could try to reproduce the issue in a proper android dev setup, and thus debug it more easily than through me? :)

@Ekleog
Copy link
Contributor Author

Ekleog commented Jan 26, 2020

Huh? I had re-attempted the “upload” choice while writing this message, and this time it did succeed in uploading, just after I clicked “send”. I have literally no idea what's happening, sorry…

So what happened is (all from ankidroid):

  • Tried to force upload, failed without error message
  • Tried to force upload again, succeeded in forcing uploading
  • Done another sync, succeeded
  • Reviewed one card
  • Done another sync, giving me the upload|download choice again

@Ekleog
Copy link
Contributor Author

Ekleog commented Jan 26, 2020

Oh by the way, having adb logcat while I press the sync button gives that output:

[...]
01-26 17:34:13.944  7283  7283 I AnkiDroid: DeckPicker:: Sync button pressed
01-26 17:34:13.983  7283  8561 I AnkiDroid: openCollection: /sdcard/AnkiDroid/collection.anki2
01-26 17:34:13.986  4062  4062 D SurfaceFlinger: duplicate layer name: changing com.ichi2.anki/com.ichi2.anki.DeckPicker to com.ichi2.anki/com.ichi2.anki.DeckPicker#1
01-26 17:34:13.996  7283  7311 D mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
01-26 17:34:14.008  7283  8561 I AnkiDroid: Sync - starting sync
01-26 17:34:14.254  7283  8561 I AnkiDroid: Sync: getting meta data from server
01-26 17:34:14.255  7283  8561 I AnkiDroid: Sync: building local meta data
01-26 17:34:14.255  7283  8561 I AnkiDroid: Sync: full sync necessary - returning
01-26 17:34:14.256  7283  8561 I AnkiDroid: Collection closed
[...]

So, as far as I can read, nothing of interest here, unfortunately.

@Ekleog
Copy link
Contributor Author

Ekleog commented Jan 26, 2020

Having succeeded in the full sync, I've just checked on anki that I could download from ankiweb and then sync properly, and it worked without a hitch, and “Check Database” returns nothing, so I guess the issue is not just in ankidroid's internal database -- though I guess removal of the ankidroid folder + reinstallation also had verified that issue, it's still a second confirmation that it appears to be dependent only on the state of the collection.

@mikehardy
Copy link
Member

01-26 17:34:14.254 7283 8561 I AnkiDroid: Sync: getting meta data from server
01-26 17:34:14.255 7283 8561 I AnkiDroid: Sync: building local meta data
01-26 17:34:14.255 7283 8561 I AnkiDroid: Sync: full sync necessary - returning

Whatever is happening between line two and line three here, where AnkiDroid determines a full sync is necessary, is the vital information. Being a bit lazy and knowing that brute force does in the end solve things I would log statements all over the place in that code path, documenting the full logical journey and the internal state in place during it, to watch what's happening then it should 🤞 be obvious?

@Ekleog
Copy link
Contributor Author

Ekleog commented Jan 26, 2020

@mikehardy Do you know of a good crash course on how to compile ankidroid from source and load it onto the phone? Never having done any real android development, I have no idea how to do it yet.

@mikehardy
Copy link
Member

@Ekleog
Copy link
Contributor Author

Ekleog commented Jan 30, 2020

Looks like these days the bug is blinking, sometimes happening and sometimes not, depending on how many cards I review.

Unfortunately, as you can see from the delay between my answers, I don't have much time right now, but I've saved a .colpkg from the time it was completely broken, and will try to investigate that when I can find some time, if no one beats me to it and asks me for the .colpkg!

@github-actions
Copy link
Contributor

github-actions bot commented Jun 2, 2020

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Jun 2, 2020
@Ekleog
Copy link
Contributor Author

Ekleog commented Jun 3, 2020

Oh, I forgot to close this: at some point a few months ago the changelog had a mention of a sync bug being fixed, and since then I haven't had the issue, so let's assume the issue is solved and close :)

@Ekleog Ekleog closed this as completed Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants