a1ex4 / ownfoil

Switch library manager, with a self-hosted Tinfoil Shop.
409 stars 39 forks source link

database corruption #106

Closed alextremblay closed 1 week ago

alextremblay commented 2 weeks ago

ran into an issue my first time using tinfoil.

steps I took to reproduce:

i re-ran ownfoil through a debugger, and i think i see the issue: during parsing of a file with a malformed filename, ownfoil encountered a file ending in [010097F018539004][USA]v0].nsp there's a typo, a missing [

i suspect the bug lies here: https://github.com/a1ex4/ownfoil/blob/31bf87f08fb3822983a62ee1c9b665998c6f0b66/app/titles.py#L197 perhaps before committing an entry into the DB, it would be best to check that versions is not None and either default to 0 or skip this title?

The problem with the current approach is that even if a user catches the issue and fixes the typo in the filename, the erroneous entry has already been added to the DB, and the user then needs to delete the db, reconfigure all their app settings, and THEN rescan

qwerty-the-lost commented 2 weeks ago

I wonder if this is the issue I'm having.

There is quite a large library on a NAS and all was well. It was adding titles and I could see them populating into the library.

At one point there was a 500 error, and the container ground to a halt. After a restart; it continued however now no matter what I try the library is blank, even though the system is confirming all the titles have been scanned.

I've tried stopping the service as well as restarting it. It goes through the motions, tells me it's generating the library but nothing.

alextremblay commented 2 weeks ago

I wonder if this is the issue I'm having.

There is quite a large library on a NAS and all was well. It was adding titles and I could see them populating into the library.

At one point there was a 500 error, and the container ground to a halt. After a restart; it continued however now no matter what I try the library is blank, even though the system is confirming all the titles have been scanned.

I've tried stopping the service as well as restarting it. It goes through the motions, tells me it's generating the library but nothing.

to see if it's the same issue, you'd have to go through the logs and look at all the errors. if you figure out which file caused issues in the first place and then fixed/removed the file, you can delete config/ownfoil.db and restart the container

a1ex4 commented 2 weeks ago

Thanks for the investigations and detailed reports, I'll make this part of the code more robust, and maybe display files with problems on the UI for identification as well.

a1ex4 commented 2 weeks ago

I've pushed a quick fix to the develop branch to at least handle the case where a value is set to None, you should try the develop tab of the image to test it.

a1ex4 commented 1 week ago

Fix has been pushed to latest version of the image.