mihonapp / mihon

Free and open source manga reader for Android
Apache License 2.0
10.73k stars 493 forks source link

Error while restoring #27

Closed BuriBuriZymon closed 3 months ago

BuriBuriZymon commented 10 months ago

Steps to reproduce

I'm unable to attach my backup. But all I did was restore a backup.

Expected behavior

There shouldve been zero errors

Actual behavior

Screenshot_2024-01-16-12-40-25-47_40deb401b9ffe8e1df2f1cc5ba480b12

But this happened

Crash logs

No response

Mihon version

0.16.0

Android version

ANDROID 14

Device

Oneplus 11r

Other details

Nothing just that. I haven't encountered any problem bc of that but wanted to share that it happened.

Sorry for wasting your time.

Acknowledgements

MajorTanya commented 10 months ago

I remember once having this same issue - out of curiosity, are the manga in question still in your library? Witch Hat Atelier for example seems to have errored.

BuriBuriZymon commented 10 months ago

I remember once having this same issue - out of curiosity, are the manga in question still in your library? Witch Hat Atelier for example seems to have errored.

Yea. All four of them are in my library and are working fine.

MajorTanya commented 10 months ago

I've fiddled a bit with an older backup of mine that caused the same error messages. It appears that the issue arises when a chapter is reuploaded/replaced in the source under the same chapter URL. If a Mihon user then reads that “new” chapter, an entirely new history entry appears to get created.

After adding some logging during my own backup restorations, I could see a few chapters with this behaviour, and their only differences were _id (makes sense), manga_id (strange?), date_fetched, date_upload, and last_modified (which all seem sensible to me).

I don't know how this could be “fixed” easily, unless additional logic is added at some step in the restoration. On such a conflict, maybe only the most recently modified/uploaded/fetched version should prevail? 🤔

Edit: Do you happen to remember whether any of your erroring series had chapters replaced/reuploaded?

Edit 2: If the getChapterByUrl query was called with awaitList instead, and then chapters.first() was used subsequently, the issue would be resolved, but the conflicting information would be ignored.

BuriBuriZymon commented 10 months ago

Edit: Do you happen to remember whether any of your erroring series had chapters replaced/reuploaded?

Not in Witch Hat and Vinland Saga but there were some chapters missing in Kingdom and Dandadan Screenshot_2024-01-17-08-24-42-94_551f7f0ca926862b368845ce7ee433aa.jpg

There were 9 chapters missing in Dandadan too and they appeared suddenly

MajorTanya commented 10 months ago

Oh, I didn't mean missing chapters or new uploads. I was talking about replacing a chapter in-place, like for example, a translation group found a mistake and decided to delete the chapter and upload a fixed version with the exact same URL. If this hunch of mine is correct, it'll be really difficult to reproduce again, especially considering that in my tests, the duplicate chapters were given different _id but also manga_id values.

I'll try to investigate a bit more soon.

BuriBuriZymon commented 10 months ago

I was talking about replacing a chapter in-place, like for example, a translation group found a mistake and decided to delete the chapter and upload a fixed version with the exact same URL.

Ooh I'm sorry I don't know how to check that 😭

MajorTanya commented 10 months ago

Ooh I'm sorry I don't know how to check that 😭

Don't worry, I think you'd basically have to remember that it happened or something, I don't think there is a direct way to check.

BuriBuriZymon commented 10 months ago

eu.kanade.tachiyomi.j2k_2024-01-16_12-34.zip

This is the backup file I used. I tried it restoring it again in the preview app and it shows those errors.

loocool2 commented 10 months ago

backups are usually in the .proto.gz or .tachibk format. did you do anything to the backup file that made it into a .zip instead?

BuriBuriZymon commented 10 months ago

I turned it into a zip file to share it bc I wasn't able to share it in those other formats

AntsyLich commented 3 months ago

647