getmango / Mango

Mango is a self-hosted manga server and web reader
https://getmango.app
MIT License
1.69k stars 120 forks source link

[Bug Report] Some files ignored by mango on rescan #287

Open alethiophile opened 2 years ago

alethiophile commented 2 years ago

Describe the bug I have some files in the Mango library that are being ignored. They exist on disk, but don't show up in the web UI and can't be scanned (ordering a rescan causes no change).

The files involved were first present as broken symlinks, and Mango ran a scan during this time period. This caused an error during the scan. However, multiple restarts and rescans since (now that the files are present) still don't see them.

Expected behavior Files present in the library show up in Mango

Environment (please complete the following information):

Leeingnyo commented 2 years ago

Hi,

Could you tell me how your files are organized in your library root path? the manga files should be in a directory, not directly in library root path. Related issue: https://github.com/hkalexling/Mango/issues/242

alethiophile commented 2 years ago

The files are under library/manga/<series name>. The whole <series name> directory doesn't show up under library/manga, in either the Web interface or the library cache.

hkalexling commented 2 years ago

I couldn't reproduce the issue with v0.24.0. I tried the following steps on a Ubuntu docker container:

  1. Let Mango create an empty library with all default settings
  2. Create a broken simlink in the library
  3. Rescan and the library is still empty as expected
  4. Fix the broken simlink
  5. Rescan and the library shows one title as expected

@alethiophile Can you try deleting the library.yml.gz file and see if it resolves the issue?

alethiophile commented 2 years ago

Okay, it took me a bit of fiddling, but I fixed it by doing:

  1. stop Mango
  2. delete the library.yml.gz file
  3. restart Mango, let it do its initial scan
hkalexling commented 2 years ago

@alethiophile That's great! This is likely an edge case that's not being handled correctly by the library caching system.

You mentioned that Mango reported an error when scanning the broken simlink. Do you happen to have the log or remember what the error was? I was trying to reproduce this, but Mango just ignored the broken simlink.

alethiophile commented 2 years ago

The error I have:

Mar 28 10:15:15 breitenfeld mango[3673]: Unhandled exception in spawn: Unable to get file info: '/home/tom/mango/library/manga/Yu-Gi-Oh/Yu-Gi-Oh! GX v01-09 (2012) (Digital) (Shellshock + Tikas)/Yu-Gi-Oh! GX v08 (2012) (Digital) (Shellshock).cbz': No such file or directory (File::NotFoundError)
Mar 28 10:15:18 breitenfeld mango[3673]:   from /usr/share/crystal/src/crystal/system/unix/file.cr:50:37 in 'info'
Mar 28 10:15:18 breitenfeld mango[3673]:   from /usr/share/crystal/src/file.cr:150:5 in 'signature'
Mar 28 10:15:18 breitenfeld mango[3673]:   from /__w/Mango/Mango/src/util/signature.cr:45:11 in 'signature'
Mar 28 10:15:18 breitenfeld mango[3673]:   from /__w/Mango/Mango/src/util/signature.cr:40:11 in 'signature'
Mar 28 10:15:18 breitenfeld mango[3673]:   from /__w/Mango/Mango/src/util/signature.cr:40:11 in 'signature'
Mar 28 10:15:18 breitenfeld mango[3673]:   from /__w/Mango/Mango/src/library/title.cr:89:5 in 'examine'
Mar 28 10:15:18 breitenfeld mango[3673]:   from /__w/Mango/Mango/src/library/library.cr:142:7 in 'scan'
Mar 28 10:15:18 breitenfeld mango[3673]:   from /__w/Mango/Mango/src/library/library.cr:59:17 in '->'
Mar 28 10:15:18 breitenfeld mango[3673]:   from /usr/share/crystal/src/primitives.cr:255:3 in 'run'
Mar 28 10:15:18 breitenfeld mango[3673]:   from ???

I'm running Mango on a subdirectory of a git-annex repository, so all the files are relative symlinks and when they get copied around the symlinks usually get broken. Thus, the chain of events here was 1. copy symlinks into the Mango library area, where they're initially broken; 2. Mango runs its periodic scan and throws the above error; 3. run the fix step that rectifies the symlinks, but further scans don't find them.