[Issue]: Database Becomes Locked On Startup #5848

Closed
opened 2026-02-07 02:27:14 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @michaelharrigan on GitHub (May 24, 2024).

Please describe your bug

After updating to the latest server version, on startup, the database seems to getting locked preventing the server to finish its setup.

Reproduction Steps

  1. Start up jellyfin server on Mac
  2. Choose to launch web UI
  3. WebUI locks and nothing proceeds successfully

Jellyfin Version

10.9.0

if other:

10.9.2

Environment

- OS: MacOS 14.5
- Linux Kernel:
- Virtualization:
- Clients: Browser, AppleTV, iOS
- Browser: Safari
- FFmpeg Version:
- Playback Method:
- Hardware Acceleration:
- GPU Model:
- Plugins:
- Reverse Proxy:
- Base URL:
- Networking: Host
- Storage: Local

Jellyfin logs

[2024-05-24 07:08:54.499 -04:00] [FTL] [1] Main: Error while starting server
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Emby.Server.Implementations.Data.SqliteExtensions.Execute(SqliteConnection sqliteConnection, String commandText)
   at Emby.Server.Implementations.Data.BaseSqliteRepository.GetConnection()
   at Emby.Server.Implementations.Data.BaseSqliteRepository.Initialize()
   at Emby.Server.Implementations.Data.SqliteItemRepository.Initialize()
   at Emby.Server.Implementations.ApplicationHost.InitializeServices()
   at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig)
[2024-05-24 07:08:54.508 -04:00] [INF] [1] Main: Running query planner optimizations in the database... This might take a while
[2024-05-24 07:08:54.522 -04:00] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing "CoreAppHost"
[2024-05-24 07:08:54.522 -04:00] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing "PluginManager"

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

CleanShot 2024-05-24 at 07 12 12@2x

Code of Conduct

  • I agree to follow this project's Code of Conduct
Originally created by @michaelharrigan on GitHub (May 24, 2024). ### Please describe your bug After updating to the latest server version, on startup, the database seems to getting locked preventing the server to finish its setup. ### Reproduction Steps 1. Start up jellyfin server on Mac 2. Choose to launch web UI 3. WebUI locks and nothing proceeds successfully ### Jellyfin Version 10.9.0 ### if other: 10.9.2 ### Environment ```markdown - OS: MacOS 14.5 - Linux Kernel: - Virtualization: - Clients: Browser, AppleTV, iOS - Browser: Safari - FFmpeg Version: - Playback Method: - Hardware Acceleration: - GPU Model: - Plugins: - Reverse Proxy: - Base URL: - Networking: Host - Storage: Local ``` ### Jellyfin logs ```shell [2024-05-24 07:08:54.499 -04:00] [FTL] [1] Main: Error while starting server Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'. at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db) at Microsoft.Data.Sqlite.SqliteDataReader.NextResult() at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior) at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader() at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery() at Emby.Server.Implementations.Data.SqliteExtensions.Execute(SqliteConnection sqliteConnection, String commandText) at Emby.Server.Implementations.Data.BaseSqliteRepository.GetConnection() at Emby.Server.Implementations.Data.BaseSqliteRepository.Initialize() at Emby.Server.Implementations.Data.SqliteItemRepository.Initialize() at Emby.Server.Implementations.ApplicationHost.InitializeServices() at Jellyfin.Server.Program.StartServer(IServerApplicationPaths appPaths, StartupOptions options, IConfiguration startupConfig) [2024-05-24 07:08:54.508 -04:00] [INF] [1] Main: Running query planner optimizations in the database... This might take a while [2024-05-24 07:08:54.522 -04:00] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing "CoreAppHost" [2024-05-24 07:08:54.522 -04:00] [INF] [1] Emby.Server.Implementations.ApplicationHost: Disposing "PluginManager" ``` ### FFmpeg logs _No response_ ### Please attach any browser or client logs here _No response_ ### Please attach any screenshots here ![CleanShot 2024-05-24 at 07 12 12@2x](https://github.com/jellyfin/jellyfin/assets/9045677/e2381654-beba-44b0-ba02-a53ae0bf9b53) ### Code of Conduct - [X] I agree to follow this project's Code of Conduct
OVERLORD added the bug label 2026-02-07 02:27:14 +03:00
Author
Owner

@jellyfin-bot commented on GitHub (May 24, 2024):

Hi, it seems like your issue report has the following item(s) that need to be addressed:

  • You have not filled in the environment completely.

This is an automated message, currently under testing. Please file an issue here if you encounter any problems.

@jellyfin-bot commented on GitHub (May 24, 2024): Hi, it seems like your issue report has the following item(s) that need to be addressed: - You have not filled in the environment completely. This is an automated message, currently under testing. Please file an issue [here](https://github.com/jellyfin/jellyfin-triage-scripts/issues) if you encounter any problems.
Author
Owner

@SteveDinn commented on GitHub (May 24, 2024):

I'm running v10.9.2 via the official docker image on Debian 11 and I see this error in the log constantly. I see it whether I am using the Android app, Android TV client, or the web client, and also the server on its own running background or scheduled tasks. Most of the time, there is only ever one user connected to Jellyfin, so it's not even that multiple people are doing things simultaneously.

Was this an consequence of the database connection pooling? Seems like if tables are going to get locked then there needs to be some sort of serialization funnel for db access. Maybe that could be a stop-gap solution on the way to implementing support for a full-fledged database like postgres or mariadb? SQLite is great and all, but it's clearly not meant for multi-threaded contexts.

@SteveDinn commented on GitHub (May 24, 2024): I'm running v10.9.2 via the official docker image on Debian 11 and I see this error in the log *constantly*. I see it whether I am using the Android app, Android TV client, or the web client, and also the server on its own running background or scheduled tasks. Most of the time, there is only ever one user connected to Jellyfin, so it's not even that multiple people are doing things simultaneously. Was this an consequence of the database connection pooling? Seems like if tables are going to get locked then there needs to be some sort of serialization funnel for db access. Maybe that could be a stop-gap solution on the way to implementing support for a full-fledged database like postgres or mariadb? SQLite is great and all, but it's clearly not meant for multi-threaded contexts.
Author
Owner

@isgallagher commented on GitHub (May 27, 2024):

I host my sqlite db on my NAS so this issue has forced me back to 10.8.13 which is working perfectly.

@isgallagher commented on GitHub (May 27, 2024): I host my sqlite db on my NAS so this issue has forced me back to 10.8.13 which is working perfectly.
Author
Owner

@holow29 commented on GitHub (Aug 24, 2024):

Seems like it could be related to #11589

@holow29 commented on GitHub (Aug 24, 2024): Seems like it could be related to #11589
Author
Owner

@jumoog commented on GitHub (Aug 25, 2024):

This shouldn't happen anymore in the latest jellyfin release.

@jumoog commented on GitHub (Aug 25, 2024): This shouldn't happen anymore in the latest jellyfin release.
Author
Owner

@felix920506 commented on GitHub (Aug 25, 2024):

Reported by user as fixed.

@felix920506 commented on GitHub (Aug 25, 2024): Reported by user as fixed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#5848