jellyfin / jellyfin

The Free Software Media System
https://jellyfin.org
GNU General Public License v2.0
35.05k stars 3.19k forks source link

[Issue]: Cannot add Shows library on v10.9.0 #11561

Closed shocker2 closed 2 months ago

shocker2 commented 6 months ago

Please describe your bug

I'm using official docker image for JF 10.9. Movies library is added successfully but while adding the Shows, it's failing at 15% with: [ERR] [164] MediaBrowser.Providers.Manager.ProviderManager: Error refreshing item Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'. at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)

Reproduction Steps

Create a new server Add Shows library

Jellyfin Version

10.9.0

if other:

No response

Environment

- OS:
- Linux Kernel:
- Virtualization:
- Clients:
- Browser:
- FFmpeg Version:
- Playback Method:
- Hardware Acceleration:
- GPU Model:
- Plugins:
- Reverse Proxy:
- Base URL:
- Networking:
- Storage:

Jellyfin logs

[ERR] [164] MediaBrowser.Providers.Manager.ProviderManager: Error refreshing item
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)

FFmpeg logs

No response

Please attach any browser or client logs here

No response

Please attach any screenshots here

No response

Code of Conduct

jellyfin-bot commented 6 months ago

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

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

shocker2 commented 6 months ago

The issue is related to parallel scans. I have set it to 1 and it's working.

prahal commented 6 months ago

https://stackoverflow.com/questions/69679018/sqliteexception-0x80004005-sqlite-error-6-database-table-is-locked-in-memo ?

This turned out to be an issue when sharing a (read-only) Sqlite connection between multiple threads. Creating separate connections for each of the threads made the issue go away. (bug in dotnet linux implementation?)

[17:02:07] [INF] [40] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting /usr/lib/jellyfin-ffmpeg/ffprobe with args -analyzeduration 200M -probesize 1G -i file:"/media/movie/Movies/C/Capitaine Sky et le monde de demain (2004)/Capitaine Sky et le monde de demain (2004) - version Fr En De.mkv" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format
[17:02:08] [WRN] [92] MediaBrowser.XbmcMetadata.Providers.MovieNfoProvider: Trailer URL uses a deprecated format : plugin://plugin.video.youtube/?action=play_video&videoid=tYZNmkZWYmQ. Using plugin://plugin.video.youtube/play/?video_id=tYZNmkZWYmQ instead is advised.
[17:02:13] [ERR] [92] MediaBrowser.Providers.Manager.ProviderManager: Error refreshing item
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 6: 'database table 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.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText, SqliteParameter[] parameters)
   at Microsoft.Data.Sqlite.SqliteTransaction..ctor(SqliteConnection connection, IsolationLevel isolationLevel, Boolean deferred)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveImages(BaseItem item)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateImagesAsync(BaseItem item, Boolean forceUpdate)
   at Emby.Server.Implementations.Library.LibraryManager.RunMetadataSavers(BaseItem item, ItemUpdateType updateReason)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Video.UpdateToRepositoryAsync(ItemUpdateType updateReason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.SaveItemAsync(MetadataResult`1 result, ItemUpdateType reason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_0`1.<<RunTasks>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func`3 task, IList`1 children, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_0`1.<<RunTasks>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func`3 task, IList`1 children, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ProviderManager.RefreshCollectionFolderChildren(MetadataRefreshOptions options, CollectionFolder collectionFolder, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ProviderManager.RefreshItem(BaseItem item, MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ProviderManager.StartProcessingRefreshQueue()
[17:02:18] [INF] [63] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: Started library sync

Environment

- OS: Linux helios64 6.8.5-edge-rockchip64 #2 SMP PREEMPT Wed Apr 10 14:38:25 UTC 2024 aarch64 GNU/Linux
- Linux Kernel: 6.8.5-edge-rockchip64 (Armbian)
- Virtualization: Docker
- Clients: web
- Browser: FF 125.0.3 64 bits
- FFmpeg Version:
- Playback Method:
- Hardware Acceleration:
- GPU Model:
- Plugins:
- Reverse Proxy:
- Base URL:
- Networking:
- Storage:

Jellyfin 10.9.0 from docker jellyfin/jellyfin:latest

Edit: removed kodi sync queue plugin mention as it looks unrelated.

shocker2 commented 6 months ago

https://stackoverflow.com/questions/69679018/sqliteexception-0x80004005-sqlite-error-6-database-table-is-locked-in-memo ?

This turned out to be an issue when sharing a (read-only) Sqlite connection between multiple threads. Creating separate connections for each of the threads made the issue go away. (bug in dotnet linux implementation?)

[17:02:07] [INF] [40] MediaBrowser.MediaEncoding.Encoder.MediaEncoder: Starting /usr/lib/jellyfin-ffmpeg/ffprobe with args -analyzeduration 200M -probesize 1G -i file:"/media/movie/Movies/C/Capitaine Sky et le monde de demain (2004)/Capitaine Sky et le monde de demain (2004) - version Fr En De.mkv" -threads 0 -v warning -print_format json -show_streams -show_chapters -show_format
[17:02:08] [WRN] [92] MediaBrowser.XbmcMetadata.Providers.MovieNfoProvider: Trailer URL uses a deprecated format : plugin://plugin.video.youtube/?action=play_video&videoid=tYZNmkZWYmQ. Using plugin://plugin.video.youtube/play/?video_id=tYZNmkZWYmQ instead is advised.
[17:02:13] [ERR] [92] MediaBrowser.Providers.Manager.ProviderManager: Error refreshing item
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 6: 'database table 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.SqliteConnectionExtensions.ExecuteNonQuery(SqliteConnection connection, String commandText, SqliteParameter[] parameters)
   at Microsoft.Data.Sqlite.SqliteTransaction..ctor(SqliteConnection connection, IsolationLevel isolationLevel, Boolean deferred)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveImages(BaseItem item)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateImagesAsync(BaseItem item, Boolean forceUpdate)
   at Emby.Server.Implementations.Library.LibraryManager.RunMetadataSavers(BaseItem item, ItemUpdateType updateReason)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Video.UpdateToRepositoryAsync(ItemUpdateType updateReason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.SaveItemAsync(MetadataResult`1 result, ItemUpdateType reason, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_0`1.<<RunTasks>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func`3 task, IList`1 children, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_0`1.<<RunTasks>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func`3 task, IList`1 children, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ProviderManager.RefreshCollectionFolderChildren(MetadataRefreshOptions options, CollectionFolder collectionFolder, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ProviderManager.RefreshItem(BaseItem item, MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.ProviderManager.StartProcessingRefreshQueue()
[17:02:18] [INF] [63] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: Started library sync

Environment

- OS: Linux helios64 6.8.5-edge-rockchip64 #2 SMP PREEMPT Wed Apr 10 14:38:25 UTC 2024 aarch64 GNU/Linux
- Linux Kernel: 6.8.5-edge-rockchip64 (Armbian)
- Virtualization: Docker
- Clients: web
- Browser: FF 125.0.3 64 bits
- FFmpeg Version:
- Playback Method:
- Hardware Acceleration:
- GPU Model:
- Plugins:
- Reverse Proxy:
- Base URL:
- Networking:
- Storage:

Jellyfin 10.9.0 from docker jellyfin/jellyfin:latest

Edit: removed kodi sync queue plugin mention as it looks unrelated.

Yes, basically If you set any value for a parallel scan instead of 0, it will work. But still, this is a bug :)

prahal commented 6 months ago

Agreed this is a bug. But I wanted to cite this Stackoverflow post as to hint that maybe Jellyfin devs used the API as documented but that it might not work as documented on Linux.

jcsomerville commented 6 months ago

I'm having the same issue. How's exactly did you set parallel scans to 1?

crobibero commented 6 months ago

Dashboard -> General -> image

KeyboardDabbler commented 6 months ago

Confirming the issue is related to parallel scans as well for me, after changing to 1, it's now working.

Previously failed to complete full library scan..

[2024-05-13 11:02:45.056 +12:00] [ERR] [69] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 6: 'database table is locked'.
[2024-05-13 11:02:45.058 +12:00] [INF] [69] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Scan Media Library" Failed after 2 minute(s) and 38 seconds
felix920506 commented 2 months ago

Users report fixed in a duplicate of this issue, closing