vinser / flibgolite

FLibGoLite is easy to use home library OPDS service you can install on your PC, NAS or server.
https://vinser.github.io/flibgolite-docs/
MIT License
8 stars 3 forks source link

Reindex panic #27

Closed Dvlbug closed 2 months ago

Dvlbug commented 2 months ago

I'm get the error SIGSEGV when using "-reindex" even on empty folder

Environment: Proxmox 7 + LXC (Debian GNU/Linux 12 bookworm) LXC parameters: CPU 2 Cores, RAM 8Gb

Console output

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9a8a42]

goroutine 7 [running]:
github.com/vinser/flibgolite/pkg/database.(*TX).txEnd(0x0)
        /home/vinser/Dev/flibgolite/pkg/database/db.go:128 +0x22
github.com/vinser/flibgolite/pkg/database.(*Handler).AddBooksToIndex.func1()
        /home/vinser/Dev/flibgolite/pkg/database/dbstock.go:31 +0x25
github.com/vinser/flibgolite/pkg/database.(*Handler).AddBooksToIndex(0xc0003ca740)
        /home/vinser/Dev/flibgolite/pkg/database/dbstock.go:55 +0x3cf
created by github.com/vinser/flibgolite/pkg/stock.(*Handler).Reindex in goroutine 1
        /home/vinser/Dev/flibgolite/pkg/stock/stock.go:78 +0x278

Log with debug level

> SERVICE: 2024/08/22 16:02:35 >>> Book stock reindex started  >>>>>>>>>>>>>>>>>>>>>>>>>>>
> INFO:    2024/08/22 16:02:35 scanning folder /files for new books...
> INFO:    2024/08/22 16:02:35 file  is not a regular file

ls -l output

> root@opds-server:/# ls -l |grep files
> drwxrwsrwx   1 nobody users    10 Aug 22 15:59 files

config

library:
  STOCK: "/files"
  TRASH: "/files/trash"

genres:
  TREE_FILE: "config/genres.xml"

database:
  DSN: "dbdata/books.db"
  POLL_DELAY: 30 
  MAX_SCAN_THREADS: 10
  BOOK_QUEUE_SIZE: 1000
  FILE_QUEUE_SIZE: 1000
  MAX_BOOKS_IN_TX: 1000

logs:
  OPDS: "logs/opds.log"
  SCAN: "logs/scan.log"
  LEVEL: "D" 

opds:
  PORT: 8085
  TITLE: "FLib Go Go Go!!!"
  PAGE_SIZE: 30

locales:
  DIR: "config/locales"
  DEFAULT: "en"
  ACCEPTED: "en, ru"
vinser commented 2 months ago

@Dvlbug - the bug is fixed in release 13 Thank you for your issue report, sorry for poor regression test after v2 major refactoring