[Bug]: Crash of audiobookshelf docker container at noon and midnight (SQLITE_READONLY state) #2550

Closed
opened 2026-04-25 00:08:18 +02:00 by adam · 9 comments
Owner

Originally created by @JakePi3 on GitHub (Feb 5, 2025).

What happened?

The server crashes periodically. This only started happening recently. I have my containers auto updating periodically. My current version is v.2.19.0

The database does respond to other write requests and this failure appears to only occur at noon and midnight.

What did you expect to happen?

Crash is really bad, not sure if the DB was temporarily put into a read-only state, in which case a retry might fix the problem.

Steps to reproduce the issue

  1. No user action necessary. It's happened twice in the last two days so likely to be a recent update. It also happens to occur at noon and midnight which leads me to suspect a cron job is triggering the crash.

Audiobookshelf version

v2.19.0

How are you running audiobookshelf?

Docker

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?

None

Logs

{"timestamp":"2025-02-04 12:00:01.539","source":"Server.js:219","message":"[Server] Unhandled rejection: Error
    at Database.<anonymous> (/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27)
    at /node_modules/sequelize/lib/dialects/sqlite/query.js:183:50
    at new Promise (<anonymous>)
    at Query.run (/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12)
    at /node_modules/sequelize/lib/sequelize.js:315:28
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SQLiteQueryInterface.update (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:355:12)
    at async Podcast.save (/node_modules/sequelize/lib/model.js:2490:35)
    at async PodcastManager.runEpisodeCheck (/server/managers/PodcastManager.js:343:5)
    at async CronManager.executePodcastCron (/server/managers/CronManager.js:195:35) {
  name: 'SequelizeDatabaseError',
  parent: [Error: SQLITE_READONLY: attempt to write a readonly database] {
    errno: 8,
    code: 'SQLITE_READONLY',
    sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3'
  },
  original: [Error: SQLITE_READONLY: attempt to write a readonly database] {
    errno: 8,
    code: 'SQLITE_READONLY',
    sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3'
  },
  sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3',
  parameters: {}
} 
promise: Promise {
  <rejected> Error
      at Database.<anonymous> (/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27)
      at /node_modules/sequelize/lib/dialects/sqlite/query.js:183:50
      at new Promise (<anonymous>)
      at Query.run (/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12)
      at /node_modules/sequelize/lib/sequelize.js:315:28
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async SQLiteQueryInterface.update (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:355:12)
      at async Podcast.save (/node_modules/sequelize/lib/model.js:2490:35)
      at async PodcastManager.runEpisodeCheck (/server/managers/PodcastManager.js:343:5)
      at async CronManager.executePodcastCron (/server/managers/CronManager.js:195:35) {
    name: 'SequelizeDatabaseError',
    parent: [Error: SQLITE_READONLY: attempt to write a readonly database] {
      errno: 8,
      code: 'SQLITE_READONLY',
      sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3'
    },
    original: [Error: SQLITE_READONLY: attempt to write a readonly database] {
      errno: 8,
      code: 'SQLITE_READONLY',
      sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3'
    },
    sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3',
    parameters: {}
  }
}","levelName":"FATAL","level":5}

Additional Notes

  • I'm running this on Unraid 7.0.0
  • I've checked that I'm running the most recent version (no updates available for my OS + appstore)
Originally created by @JakePi3 on GitHub (Feb 5, 2025). ### What happened? The server crashes periodically. This only started happening recently. I have my containers auto updating periodically. My current version is v.2.19.0 The database does respond to other write requests and this failure appears to only occur at noon and midnight. ### What did you expect to happen? Crash is really bad, not sure if the DB was temporarily put into a read-only state, in which case a retry might fix the problem. ### Steps to reproduce the issue 1. No user action necessary. It's happened twice in the last two days so likely to be a recent update. It also happens to occur at noon and midnight which leads me to suspect a cron job is triggering the crash. ### Audiobookshelf version v2.19.0 ### How are you running audiobookshelf? Docker ### 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? None ### Logs ```shell {"timestamp":"2025-02-04 12:00:01.539","source":"Server.js:219","message":"[Server] Unhandled rejection: Error at Database.<anonymous> (/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27) at /node_modules/sequelize/lib/dialects/sqlite/query.js:183:50 at new Promise (<anonymous>) at Query.run (/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12) at /node_modules/sequelize/lib/sequelize.js:315:28 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SQLiteQueryInterface.update (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:355:12) at async Podcast.save (/node_modules/sequelize/lib/model.js:2490:35) at async PodcastManager.runEpisodeCheck (/server/managers/PodcastManager.js:343:5) at async CronManager.executePodcastCron (/server/managers/CronManager.js:195:35) { name: 'SequelizeDatabaseError', parent: [Error: SQLITE_READONLY: attempt to write a readonly database] { errno: 8, code: 'SQLITE_READONLY', sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3' }, original: [Error: SQLITE_READONLY: attempt to write a readonly database] { errno: 8, code: 'SQLITE_READONLY', sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3' }, sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3', parameters: {} } promise: Promise { <rejected> Error at Database.<anonymous> (/node_modules/sequelize/lib/dialects/sqlite/query.js:185:27) at /node_modules/sequelize/lib/dialects/sqlite/query.js:183:50 at new Promise (<anonymous>) at Query.run (/node_modules/sequelize/lib/dialects/sqlite/query.js:183:12) at /node_modules/sequelize/lib/sequelize.js:315:28 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async SQLiteQueryInterface.update (/node_modules/sequelize/lib/dialects/abstract/query-interface.js:355:12) at async Podcast.save (/node_modules/sequelize/lib/model.js:2490:35) at async PodcastManager.runEpisodeCheck (/server/managers/PodcastManager.js:343:5) at async CronManager.executePodcastCron (/server/managers/CronManager.js:195:35) { name: 'SequelizeDatabaseError', parent: [Error: SQLITE_READONLY: attempt to write a readonly database] { errno: 8, code: 'SQLITE_READONLY', sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3' }, original: [Error: SQLITE_READONLY: attempt to write a readonly database] { errno: 8, code: 'SQLITE_READONLY', sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3' }, sql: 'UPDATE `podcasts` SET `lastEpisodeCheck`=$1,`updatedAt`=$2 WHERE `id` = $3', parameters: {} } }","levelName":"FATAL","level":5} ``` ### Additional Notes * I'm running this on Unraid 7.0.0 * I've checked that I'm running the most recent version (no updates available for my OS + appstore)
adam added the bug label 2026-04-25 00:08:18 +02:00
adam closed this issue 2026-04-25 00:08:18 +02:00
Author
Owner

@advplyr commented on GitHub (Feb 5, 2025):

Do you have a podcast with auto download episodes scheduled?

@advplyr commented on GitHub (Feb 5, 2025): Do you have a podcast with auto download episodes scheduled?
Author
Owner

@JakePi3 commented on GitHub (Feb 5, 2025):

Yes I have ~6 podcasts set to download hourly. But the app doesn't crash every hour, so might be some kind of race condition?

@JakePi3 commented on GitHub (Feb 5, 2025): Yes I have ~6 podcasts set to download hourly. But the app doesn't crash every hour, so might be some kind of race condition?
Author
Owner

@advplyr commented on GitHub (Feb 5, 2025):

Do you have auto backups scheduled? Maybe the podcast cron is running at the same time the backup is happening causing an issue.

Very early on I remember a few users switching their backup schedule so it didn't run at the same time but everything has been much improved since then and I don't recall any specific issues.

@advplyr commented on GitHub (Feb 5, 2025): Do you have auto backups scheduled? Maybe the podcast cron is running at the same time the backup is happening causing an issue. Very early on I remember a few users switching their backup schedule so it didn't run at the same time but everything has been much improved since then and I don't recall any specific issues.
Author
Owner

@JakePi3 commented on GitHub (Feb 5, 2025):

I don't have backups scheduled for my Docker containers, but it's possible that "Mover" could be trying to displace the DB file. This is an Unraid process that redistributes files from the cache disk to the disk array. Normally it just skips files that have any open handles.

@JakePi3 commented on GitHub (Feb 5, 2025): I don't have backups scheduled for my Docker containers, but it's possible that "Mover" could be trying to displace the DB file. This is an Unraid process that redistributes files from the cache disk to the disk array. Normally it just skips files that have any open handles.
Author
Owner

@advplyr commented on GitHub (Feb 5, 2025):

It could be. What is your mover schedule set up as?
I also run Unraid and haven't had this issue.

@advplyr commented on GitHub (Feb 5, 2025): It could be. What is your mover schedule set up as? I also run Unraid and haven't had this issue.
Author
Owner

@JakePi3 commented on GitHub (Feb 5, 2025):

I have the mover.tuning plugin applied.

For both crashes that I experienced the tuner is the last thing to execute in the syslog before the docker container shuts down:

Feb  4 11:28:12 bucket root: ionice -c 2 -n 0 nice -n 0 /usr/local/emhttp/plugins/ca.mover.tuning/age_mover start
Feb  4 12:00:02 bucket kernel: docker0: port 1(vethd4c67c6) entered disabled state

And

Feb  5 03:40:01 bucket root: ionice -c 2 -n 0 nice -n 0 /usr/local/emhttp/plugins/ca.mover.tuning/age_mover start
Feb  5 04:00:02 bucket kernel: docker0: port 1(vethccd1ce5) entered disabled state

I was wrong about noon midnight.. But the noon and 4am times DO correspond to the audiobookshelf Docker crash.

For now, my workaround is to reconfigure the appdata/ share to live on the cache pool ONLY, and then Mover should never touch it in the future.

@JakePi3 commented on GitHub (Feb 5, 2025): I have the mover.tuning plugin applied. For both crashes that I experienced the tuner is the last thing to execute in the syslog before the docker container shuts down: ``` Feb 4 11:28:12 bucket root: ionice -c 2 -n 0 nice -n 0 /usr/local/emhttp/plugins/ca.mover.tuning/age_mover start Feb 4 12:00:02 bucket kernel: docker0: port 1(vethd4c67c6) entered disabled state ``` And ``` Feb 5 03:40:01 bucket root: ionice -c 2 -n 0 nice -n 0 /usr/local/emhttp/plugins/ca.mover.tuning/age_mover start Feb 5 04:00:02 bucket kernel: docker0: port 1(vethccd1ce5) entered disabled state ``` I was wrong about noon midnight.. But the noon and 4am times DO correspond to the audiobookshelf Docker crash. For now, my workaround is to reconfigure the appdata/ share to live on the cache pool ONLY, and then Mover should never touch it in the future.
Author
Owner

@JakePi3 commented on GitHub (Feb 5, 2025):

In the last two days I've had to update the mover tuning plugin because my pre-existing plugin was incompatible with 7.0.0. The unraid app store had two competing versions but the one I had installed was no longer being maintained, and crucially did not receive the update necessary to make it compatible with 7.0.0.

So for a while, Mover was not running at all, and my cache drive was filling up. I've recently made the change to install the correct plugin and get mover working again.

I also haven't experienced any issues like this before and I've been running audiobookshelf container for 6+ months (with no crashes or downtime at all!!)

So could be a combination of 7.0.0 unraid, plus migration to updated mover tunning app.

@JakePi3 commented on GitHub (Feb 5, 2025): In the last two days I've had to update the mover tuning plugin because my pre-existing plugin was incompatible with 7.0.0. The unraid app store had two competing versions but the one I had installed was no longer being maintained, and crucially did not receive the update necessary to make it compatible with 7.0.0. So for a while, Mover was not running at all, and my cache drive was filling up. I've recently made the change to install the correct plugin and get mover working again. I also haven't experienced any issues like this before and I've been running audiobookshelf container for 6+ months (with no crashes or downtime at all!!) So could be a combination of 7.0.0 unraid, plus migration to updated mover tunning app.
Author
Owner

@advplyr commented on GitHub (Feb 5, 2025):

Ah okay that is the issue. For issues like this where the database can't be written to we want the server to crash.

I don't see this as an Abs bug so I'm going to close this but let me know if you think this is a bug we should address.
Thanks for sharing your workaround.

@advplyr commented on GitHub (Feb 5, 2025): Ah okay that is the issue. For issues like this where the database can't be written to we want the server to crash. I don't see this as an Abs bug so I'm going to close this but let me know if you think this is a bug we should address. Thanks for sharing your workaround.
Author
Owner

@JakePi3 commented on GitHub (Feb 11, 2025):

Follow up for anyone experiencing this problem. It appears that mover was causing the problem, and my workaround worked. I haven't had problems in the past week. Could be that 7.0.0 unraid upgrade changed the share configuration of appdata.

@JakePi3 commented on GitHub (Feb 11, 2025): Follow up for anyone experiencing this problem. It appears that mover was causing the problem, and my workaround worked. I haven't had problems in the past week. Could be that 7.0.0 unraid upgrade changed the share configuration of appdata.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#2550