getmango / Mango

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

[Bug Report] Unable to scan library. #339

Open tr7zw opened 1 year ago

tr7zw commented 1 year ago

Describe the bug Exception during the server start:

Mango - Manga Server and Web Reader. Version 0.27.0
Unhandled exception in spawn: Arithmetic overflow (OverflowError)
  from usr/share/crystal/src/string.cr:5200:7 in 'new'
  from Mango/src/library/title.cr:57:19 in 'initialize'
  from usr/share/crystal/src/pointer.cr:130:6 in 'scan'
  from Mango/src/library/library.cr:101:17 in '->'
  from usr/share/crystal/src/primitives.cr:255:3 in 'run'
  from ???
[ERROR]   2022/09/29 20:30:42 | Nil assertion failed

And trying to trigger a scan just shows Failed to trigger a scan. Error: [object Object] with an "500 Internal Server Error" in the browser log. No entries show up.

Environment (please complete the following information):

hkalexling commented 1 year ago

That's strange I've never seen this message before. Just to check - does removing the cache file ~/mango/library.yml.gz help?

tr7zw commented 1 year ago

Kept getting this error on a clean install(deleted database). Was able to pinpoint it to a few flat file folders that do contain files with emojis and other unusual characters in the filename, which hasn't caused an issue in the past. Next time I'm tinkering on the mango instance, I'll try it again. (Currently have the stuff outside of the lib folder)

xinyazhang commented 1 year ago

@tr7zw This is due to an integer overflow at https://github.com/getmango/Mango/blob/1fb48648ad7c4b7e0eae0730dc30255184ec8aed/src/library/dir_entry.cr#L36

Change size_sum = 0 to size_sum = 0_i64 will fix this.