advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
5.52k stars 379 forks source link

[Bug]: SequelizeDatabaseError: SQLITE_FULL: database or disk is full #2949

Closed Wonneproppen closed 3 weeks ago

Wonneproppen commented 3 weeks ago

What happened?

Audiobookshelf stops working after each and any database transaction. After a restart I can see the following error message: SequelizeDatabaseError: SQLITE_FULL: database or disk is full There is enough space on the disk, so this does not seem to be the issue.

What did you expect to happen?

Audiobookshelf should not stop working ;-)

Steps to reproduce the issue

  1. start Audiobookshelf on my QNAP
  2. trigger database transaction

Audiobookshelf version

2.8.1

How are you running audiobookshelf?

Other (list in "Additional Notes" box)

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Chrome

Logs

[Server] Unhandled rejection: SequelizeDatabaseError: SQLITE_FULL: database or disk is full, promise: Promise { <rejected> Error at Database.<anonymous> (/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/audiobookshelf/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27) at /share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/audiobookshelf/node_modules/sequelize/lib/dialects/sqlite/query.js:183:50 at new Promise (<anonymous>) at Query.run (/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/audiobookshelf/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12) at /share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/audiobookshelf/node_modules/sequelize/lib/sequelize.js:315:28 at async SQLiteQueryInterface.select (/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/audiobookshelf/node_modules/sequelize/lib/dialects/abstract/query-interface.js:407:12) at async bookSeries.findAll (/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/audiobookshelf/node_modules/sequelize/lib/model.js:1140:21) at async ApiRouter.handleDeleteLibraryItem (/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/audiobookshelf/server/routers/ApiRouter.js:356:26) at async ApiRouter.removeLibraryItemsWithIssues (/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/audiobookshelf/server/controllers/LibraryController.js:370:7) { name: 'SequelizeDatabaseError', parent: [Error: SQLITE_FULL: database or disk is full] { errno: 13, code: 'SQLITE_FULL', sql: "SELECT `bookSeries`.`id`, `bookSeries`.`sequence`, `bookSeries`.`createdAt`, `bookSeries`.`bookId`, `bookSeries`.`seriesId`, `series`.`id` AS `series.id`, `series`.`name` AS `series.name`, `series`.`nameIgnorePrefix` AS `series.nameIgnorePrefix`, `series`.`description` AS `series.description`, `series`.`createdAt` AS `series.createdAt`, `series`.`updatedAt` AS `series.updatedAt`, `series`.`libraryId` AS `series.libraryId`, `series->books`.`id` AS `series.books.id`, `series->books`.`title` AS `series.books.title`, `series->books`.`titleIgnorePrefix` AS `series.books.titleIgnorePrefix`, `series->books`.`subtitle` AS `series.books.subtitle`, `series->books`.`publishedYear` AS `series.books.publishedYear`, `series->books`.`publishedDate` AS `series.books.publishedDate`, `series->books`.`publisher` AS `series.books.publisher`, `series->books`.`description` AS `series.books.description`, `series->books`.`isbn` AS `series.books.isbn`, `series->books`.`asin` AS `series.books.asin`, `series->books`.`language` AS `series.books.language`, `series->books`.`explicit` AS `series.books.explicit`, `series->books`.`abridged` AS `series.books.abridged`, `series->books`.`coverPath` AS `series.books.coverPath`, `series->books`.`duration` AS `series.books.duration`, `series->books`.`narrators` AS `series.books.narrators`, `series->books`.`audioFiles` AS `series.books.audioFiles`, `series->books`.`ebookFile` AS `series.books.ebookFile`, `series->books`.`chapters` AS `series.books.chapters`, `series->books`.`tags` AS `series.books.tags`, `series->books`.`genres` AS `series.books.genres`, `series->books`.`createdAt` AS `series.books.createdAt`, `series->books`.`updatedAt` AS `series.books.updatedAt`, `series->books->bookSeries`.`id` AS `series.books.bookSeries.id`, `series->books->bookSeries`.`sequence` AS `series.books.bookSeries.sequence`, `series->books->bookSeries`.`createdAt` AS `series.books.bookSeries.createdAt`, `series->books->bookSeries`.`bookId` AS `series.books.bookSeries.bookId`, `series->books->bookSeries`.`seriesId` AS `series.books.bookSeries.seriesId` FROM `bookSeries` AS `bookSeries` LEFT OUTER JOIN `series` AS `series` ON `bookSeries`.`seriesId` = `series`.`id` LEFT OUTER JOIN ( `bookSeries` AS `series->books->bookSeries` INNER JOIN `books` AS `series->books` ON `series->books`.`id` = `series->books->bookSeries`.`bookId`) ON `series`.`id` = `series->books->bookSeries`.`seriesId` WHERE `bookSeries`.`bookId` = '1361275f-1b06-491e-9361-35e9ab763a6b';" }, original: [Error: SQLITE_FULL: database or disk is full] { errno: 13, code: 'SQLITE_FULL', sql: "SELECT `bookSeries`.`id`, `bookSeries`.`sequence`, `bookSeries`.`createdAt`, `bookSeries`.`bookId`, `bookSeries`.`seriesId`, `series`.`id` AS `series.id`, `series`.`name` AS `series.name`, `series`.`nameIgnorePrefix` AS `series.nameIgnorePrefix`, `series`.`description` AS `series.description`, `series`.`createdAt` AS `series.createdAt`, `series`.`updatedAt` AS `series.updatedAt`, `series`.`libraryId` AS `series.libraryId`, `series->books`.`id` AS `series.books.id`, `series->books`.`title` AS `series.books.title`, `series->books`.`titleIgnorePrefix` AS `series.books.titleIgnorePrefix`, `series->books`.`subtitle` AS `series.books.subtitle`, `series->books`.`publishedYear` AS `series.books.publishedYear`, `series->books`.`publishedDate` AS `series.books.publishedDate`, `series->books`.`publisher` AS `series.books.publisher`, `series->books`.`description` AS `series.books.description`, `series->books`.`isbn` AS `series.books.isbn`, `series->books`.`asin` AS `series.books.asin`, `series->books`.`language` AS `series.books.language`, `series->books`.`explicit` AS `series.books.explicit`, `series->books`.`abridged` AS `series.books.abridged`, `series->books`.`coverPath` AS `series.books.coverPath`, `series->books`.`duration` AS `series.books.duration`, `series->books`.`narrators` AS `series.books.narrators`, `series->books`.`audioFiles` AS `series.books.audioFiles`, `series->books`.`ebookFile` AS `series.books.ebookFile`, `series->books`.`chapters` AS `series.books.chapters`, `series->books`.`tags` AS `series.books.tags`, `series->books`.`genres` AS `series.books.genres`, `series->books`.`createdAt` AS `series.books.createdAt`, `series->books`.`updatedAt` AS `series.books.updatedAt`, `series->books->bookSeries`.`id` AS `series.books.bookSeries.id`, `series->books->bookSeries`.`sequence` AS `series.books.bookSeries.sequence`, `series->books->bookSeries`.`createdAt` AS `series.books.bookSeries.createdAt`, `series->books->bookSeries`.`bookId` AS `series.books.bookSeries.bookId`, `series->books->bookSeries`.`seriesId` AS `series.books.bookSeries.seriesId` FROM `bookSeries` AS `bookSeries` LEFT OUTER JOIN `series` AS `series` ON `bookSeries`.`seriesId` = `series`.`id` LEFT OUTER JOIN ( `bookSeries` AS `series->books->bookSeries` INNER JOIN `books` AS `series->books` ON `series->books`.`id` = `series->books->bookSeries`.`bookId`) ON `series`.`id` = `series->books->bookSeries`.`seriesId` WHERE `bookSeries`.`bookId` = '1361275f-1b06-491e-9361-35e9ab763a6b';" }, sql: "SELECT `bookSeries`.`id`, `bookSeries`.`sequence`, `bookSeries`.`createdAt`, `bookSeries`.`bookId`, `bookSeries`.`seriesId`, `series`.`id` AS `series.id`, `series`.`name` AS `series.name`, `series`.`nameIgnorePrefix` AS `series.nameIgnorePrefix`, `series`.`description` AS `series.description`, `series`.`createdAt` AS `series.createdAt`, `series`.`updatedAt` AS `series.updatedAt`, `series`.`libraryId` AS `series.libraryId`, `series->books`.`id` AS `series.books.id`, `series->books`.`title` AS `series.books.title`, `series->books`.`titleIgnorePrefix` AS `series.books.titleIgnorePrefix`, `series->books`.`subtitle` AS `series.books.subtitle`, `series->books`.`publishedYear` AS `series.books.publishedYear`, `series->books`.`publishedDate` AS `series.books.publishedDate`, `series->books`.`publisher` AS `series.books.publisher`, `series->books`.`description` AS `series.books.description`, `series->books`.`isbn` AS `series.books.isbn`, `series->books`.`asin` AS `series.books.asin`, `series->books`.`language` AS `series.books.language`, `series->books`.`explicit` AS `series.books.explicit`, `series->books`.`abridged` AS `series.books.abridged`, `series->books`.`coverPath` AS `series.books.coverPath`, `series->books`.`duration` AS `series.books.duration`, `series->books`.`narrators` AS `series.books.narrators`, `series->books`.`audioFiles` AS `series.books.audioFiles`, `series->books`.`ebookFile` AS `series.books.ebookFile`, `series->books`.`chapters` AS `series.books.chapters`, `series->books`.`tags` AS `series.books.tags`, `series->books`.`genres` AS `series.books.genres`, `series->books`.`createdAt` AS `series.books.createdAt`, `series->books`.`updatedAt` AS `series.books.updatedAt`, `series->books->bookSeries`.`id` AS `series.books.bookSeries.id`, `series->books->bookSeries`.`sequence` AS `series.books.bookSeries.sequence`, `series->books->bookSeries`.`createdAt` AS `series.books.bookSeries.createdAt`, `series->books->bookSeries`.`bookId` AS `series.books.bookSeries.bookId`, `series->books->bookSeries`.`seriesId` AS `series.books.bookSeries.seriesId` FROM `bookSeries` AS `bookSeries` LEFT OUTER JOIN `series` AS `series` ON `bookSeries`.`seriesId` = `series`.`id` LEFT OUTER JOIN ( `bookSeries` AS `series->books->bookSeries` INNER JOIN `books` AS `series->books` ON `series->books`.`id` = `series->books->bookSeries`.`bookId`) ON `series`.`id` = `series->books->bookSeries`.`seriesId` WHERE `bookSeries`.`bookId` = '1361275f-1b06-491e-9361-35e9ab763a6b';", parameters: {} } }

Additional Notes

It runs on a X86 QNAP via https://www.myqnap.org/product/audiobookshelf/

nichwall commented 3 weeks ago

Looks like you have a corrupt database. Can you try restoring from a backup?

Wonneproppen commented 3 weeks ago

Thanks for the quick reply. I tried the following:

  1. restoring backup from last night
  2. completly deinstall audiobookshelf and restore backup a. from last night b. created 3 weeks ago result for all: during backup installation: lost web socket connection, stopped working
nichwall commented 3 weeks ago

Can you look at any logs? Crash logs are stored in /metadata/logs/crash_logs.txt.

Is /config, where the database is stored, on a network drive?

Wonneproppen commented 3 weeks ago

During recovery: {"timestamp":"2024-05-09 07:45:13.308","source":"Server.js:164","message":"[Server] Unhandled rejection: Error: ENOENT: no such file or directory, open '/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/metadata/authors/1273b1ff-e35a-48a7-911a-a3f17c27cb96.jpg', promise: Promise {\n [Error: ENOENT: no such file or directory, open '/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/metadata/authors/1273b1ff-e35a-48a7-911a-a3f17c27cb96.jpg'] {\n errno: -2,\n code: 'ENOENT',\n syscall: 'open',\n path: '/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/metadata/authors/1273b1ff-e35a-48a7-911a-a3f17c27cb96.jpg'\n }\n}","levelName":"FATAL","level":5mestamp":"2024-05-09 07:45:13.308","source":"Server.js:164","message":"[Server] Unhandled rejection: Error: ENOENT: no such file or directory, open '/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/metadata/authors/1273b1ff-e35a-48a7-911a-a3f17c27cb96.jpg', promise: Promise {\n [Error: ENOENT: no such file or directory, open '/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/metadata/authors/1273b1ff-e35a-48a7-911a-a3f17c27cb96.jpg'] {\n errno: -2,\n code: 'ENOENT',\n syscall: 'open',\n path: '/share/CACHEDEV1_DATA/.qpkg/Audiobookshelf/metadata/authors/1273b1ff-e35a-48a7-911a-a3f17c27cb96.jpg'\n }\n}","levelName":"FATAL","level":5}

nichwall commented 3 weeks ago

Is this restoring from a backup using the web interface or are you manually extracting and applying the backup?

Can you try upgrading your server to 2.9.0 and then restoring a backup? There were some backup issues fixed in the past month or so but don't remember exactly when they were found/fixed.

Wonneproppen commented 3 weeks ago

I am doing the backups/restore via the web interface.

Will do as soon as the qpkg for 2.9.0. is available (https://www.myqnap.org/product/audiobookshelf/)

nichwall commented 3 weeks ago

Sounds good, thanks! The QNAP package is not maintained by us, so not sure when you can get that. If you're using docker you can get updates immediately by updating the tag you're pulling from.

Wonneproppen commented 3 weeks ago

I installed it via docker with the same behavior. After restoring the backup, abs stopped working.

advplyr commented 3 weeks ago

I'm not sure that this is an Abs issue. It seems like you are having issues with the file system and you should reach out to the QPKG maintainer.

nichwall commented 3 weeks ago

I wonder if the QNAP system does something weird (like allowing for multiple access to the SQLite database and causing corruption)? I'm not familiar with how "corrupt" the database can get before it fails. Is it any corruption, only certain columns/lookup related things being accessed, etc?

How big is the SQLite file?

Wonneproppen commented 3 weeks ago

I am using abs since ~1 year on my qnap via qpkg and never had such an issue. I was also running version 2.8.1. via qpkg since some months. Interesting fact: I rolled back an old backup (~1 month) and now abs is working stable, but I am getting [FfmpegHelpers] Resize Image Error Error: spawn /opt/ffmpeg/ffmpeg EACCES undefined undefined. Thanks for your support and this really great software!

caffeineaddiction commented 2 weeks ago

""" (13) SQLITE_FULL The SQLITE_FULL result code indicates that a write could not complete because the disk is full. Note that this error can occur when trying to write information into the main database file, or it can also occur when writing into temporary disk files.

Sometimes applications encounter this error even though there is an abundance of primary disk space because the error occurs when writing into temporary disk files on a system where temporary files are stored on a separate partition with much less space that the primary disk. """

https://www.sqlite.org/rescode.html#full

possibly out of memory and swap was turned off?