Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library Scan Failing Repeatedly after 10.9 ('database is locked') #11589

Open
mlclns opened this issue May 13, 2024 · 100 comments
Open

Library Scan Failing Repeatedly after 10.9 ('database is locked') #11589

mlclns opened this issue May 13, 2024 · 100 comments
Labels
bug Something isn't working

Comments

@mlclns
Copy link

mlclns commented May 13, 2024

Please describe your bug

Server/Web/Build Version: 10.9.1
Deployment: Docker (linuxserver/jellyfin)

Prelude: There are no other Jellyfin instances hooking into the database as far as I can tell. I did not set up any alternate instances with the same data directory mounts. I have docker compose down'ed the container and re docker compose up'ed it numerous times thinking maybe there was some duplicate service running after upgrade, but to no avail.

Upon updating to 10.9, I was unable to refresh and scan my library at all, getting the 'database table is locked' error for SQLite, but I diagnosed this as an incompatibility with a plugin, which I removed and fixed my issue. However, now after updating to 10.9.1, I'm getting stuck on a similar error, but cannot find any culprit (Interestingly my 10.9.1 upgrade also coincided with my Jellyfin restarting itself every 30 minutes or so, but I can't figure out that one right now). I cannot find anyone mentioning this issue regarding their 10.9 upgrade, other than a few mentions in the nightly stages, which seem to have been issues that have since been patched. Relevant logs attached.

Any help solving this would be greatly appreciated!

Reproduction Steps

Upgrade a 10.9.0 linuxserver/jellyfin container to 10.9.1 by docker compose pull && docker compose down && docker compose up -d to recreate the containers. Upon doing so and waiting for the service to start up, completing a library scan will be impossible due to this error captured in the logs every time. My docker-compose.yml has the environment variable JELLYFIN_playlists:allowDuplicates=false, and the following mounts:

    volumes:
      - ./library:/config
      - /mnt/media1/media/Music:/data/music:ro
      - /mnt/media1/media/Anime:/data/anime:ro
      - /mnt/media2/media/Anime:/data/anime2:ro
      - /mnt/media1/media/TV:/data/tv:ro
      - /mnt/media2/media/TV:/data/tv2:ro
      - /mnt/media1/media/Movies:/data/movies:ro
      - /mnt/media2/media/Movies:/data/movies2:ro
      - /mnt/media1/media/YouTube:/data/youtube
      - ./woff2:/data/fonts

Jellyfin Version

10.9.0

if other:

10.9.1

Environment

- OS: Fedora 37
- Linux Kernel: 6.4.6
- Virtualization: Docker
- Clients: Browser
- Browser: Firefox 125.0.3
- FFmpeg Version: N/A
- Playback Method: N/A
- Hardware Acceleration: Intel Quicksync
- GPU Model: Intel® UHD Graphics 630
- Plugins: AniList, AudioDB, Kodi Sync Queue, MusicBrainz, OMDb, Playback Reporting Status Activity, Studio Images, TMDb, *TheTVDB **[DISABLED]***
- Reverse Proxy: SWAG
- Base URL: play.mydomain.tld
- Networking: Ports passed through to host
- Storage: Seagate Ironwolf 10TB

Jellyfin logs

[2024-05-13 01:47:16.908 -04:00] [ERR] [52] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   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.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.CreateItems(IReadOnlyList`1 items, BaseItem parent, 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.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.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.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.Controller.Entities.AggregateFolder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.PerformLibraryValidation(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.ValidateMediaLibraryInternal(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
[2024-05-13 01:47:16.910 -04:00] [INF] [52] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Scan Media Library" Failed after 5 minute(s) and 3 seconds


### FFmpeg logs

_No response_

### Please attach any browser or client logs here

_No response_

### Please attach any screenshots here

_No response_

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
@mlclns mlclns added the bug Something isn't working label May 13, 2024
@SkalCore
Copy link

same error here, after failure from update to 10.9.0 and the hotfix update 10.9.1 library scans did not run completly and i must restart library scan manually again to finish the scan

@gnattu
Copy link
Member

gnattu commented May 13, 2024

Does setting parallel scanning to 1 help? You can change it in Dashboard->General, under performance section

@jellyfin-bot jellyfin-bot added this to Needs triage in Issue Triage for Main Repo May 13, 2024
@mlclns
Copy link
Author

mlclns commented May 13, 2024

Attempting this now

@mlclns
Copy link
Author

mlclns commented May 13, 2024

Well, the log error changed at least, but still wasn't able to complete the scan:

[2024-05-13 02:52:16.204 -04:00] [ERR] [29] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
System.InvalidOperationException: Must add values for the following parameters: @Type2, @Value2, @CleanValue2
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
   at Emby.Server.Implementations.Data.SqliteItemRepository.InsertItemValues(Guid id, List`1 values, SqliteConnection db)
   at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemValues(Guid itemId, List`1 values, SqliteConnection db)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTransaction(SqliteConnection db, IEnumerable`1 tuples)
   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, 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.Audio.MusicAlbum.RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, 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.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.Controller.Entities.AggregateFolder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.PerformLibraryValidation(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.ValidateMediaLibraryInternal(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
[2024-05-13 02:52:16.205 -04:00] [INF] [29] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Scan Media Library" Failed after 5 minute(s) and 11 seconds

@Emporea
Copy link

Emporea commented May 13, 2024

Same error here. Docker. Upgraded from 10.8.13-1 to 10.9.1.
Activated Trickplay + trickplay at library scan for 3 libraries containing shows and movies.
Then I manually ran a library scan and it failed.

Edit:
Reverting to 10.8.13-1 until this issue has been resolved.

@JMiles42
Copy link

I was having the same issue with Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'. during library scans.

Does setting parallel scanning to 1 help? You can change it in Dashboard->General, under performance section

I am running it on a 24 core machine, reducing the thread count down to 2, seems to have resolved it for me.

@prahal
Copy link

prahal commented May 13, 2024

@mlclns I think you should open another bug report for this other error. It looks like the issue in this bug report and this other one has nothing in common.
If you want both fixed better open two bug reports.
For me setting the parallel scan and parallel encoding to 1 let me complete the library scan (while I had this sqlite error with them set to 0, ie max).

[2024-05-13 02:52:16.204 -04:00] [ERR] [29] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
System.InvalidOperationException: Must add values for the following parameters: @type2, @value2, @CleanValue2
at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Sqlite.SqliteCommand.ExecuteNonQuery()
at Emby.Server.Implementations.Data.SqliteItemRepository.InsertItemValues(Guid id, List1 values, SqliteConnection db) at Emby.Server.Implementations.Data.SqliteItemRepository.UpdateItemValues(Guid itemId, List1 values, SqliteConnection db)
at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTransaction(SqliteConnection db, IEnumerable1 tuples) at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(IReadOnlyList1 items, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken) at MediaBrowser.Providers.Manager.MetadataService2.SaveItemAsync(MetadataResult1 result, ItemUpdateType reason, CancellationToken cancellationToken) at MediaBrowser.Providers.Manager.MetadataService2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Audio.MusicAlbum.RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress1 progress, CancellationToken cancellationToken) at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, IProgress1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress1 progress, CancellationToken cancellationToken) at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_01.<b__1>d.MoveNext()
--- End of stack trace from previous location ---
at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func3 task, IList1 children, IProgress1 progress, CancellationToken cancellationToken) at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_01.<<RunTasks>b__1>d.MoveNext() --- End of stack trace from previous location --- at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func3 task, IList1 children, IProgress1 progress, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.RefreshChildMetadata(BaseItem child, MetadataRefreshOptions refreshOptions, Boolean recursive, IProgress1 progress, CancellationToken cancellationToken) at MediaBrowser.Controller.Entities.Folder.<>c__DisplayClass69_01.<b__1>d.MoveNext()
--- End of stack trace from previous location ---
at MediaBrowser.Controller.Entities.Folder.RunTasks[T](Func3 task, IList1 children, IProgress1 progress, CancellationToken cancellationToken) at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal(IProgress1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken) at MediaBrowser.Controller.Entities.AggregateFolder.ValidateChildrenInternal(IProgress1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.PerformLibraryValidation(IProgress1 progress, CancellationToken cancellationToken) at Emby.Server.Implementations.Library.LibraryManager.ValidateMediaLibraryInternal(IProgress1 progress, CancellationToken cancellationToken)
at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
[2024-05-13 02:52:16.205 -04:00] [INF] [29] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Scan Media Library" Failed after 5 minute(s) and 11 seconds

@mlclns
Copy link
Author

mlclns commented May 13, 2024

Copy that, will do!

@MrCosmo
Copy link

MrCosmo commented May 13, 2024

Does setting parallel scanning to 1 help? You can change it in Dashboard->General, under performance section

I had a similar issue on my Synology DS224+.

Can confirm that the above suggestion was a workaround for me.

@Cwavs
Copy link

Cwavs commented May 13, 2024

I started getting this issues on JF after the 10.9.1 upgrade. I didn't notice it happening on 10.9, but it may have happened when I didn't notice. Trickplay is currently still generating, not sure if that's potentially relevant. The parallel scanning workaround does appear to have helped though. Relevant logs below:

Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 6: 'database table is locked'.
   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.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, 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.Audio.MusicAlbum.RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, 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.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.Controller.Entities.AggregateFolder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.PerformLibraryValidation(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.ValidateMediaLibraryInternal(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)```

@speatzle
Copy link

I am also Running into this since i upgraded to 10.9.

Running in Proxmox LXC

Due to the Migration i have the jellyscrub migration, library scan and intro detection running resulting in frequent lockups.

Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 6: 'database table is locked'.
   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.SaveItems(IReadOnlyList`1 items, CancellationToken cancellationToken)
   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.TV.Series.RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress`1 progress, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, 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.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.Controller.Entities.AggregateFolder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.PerformLibraryValidation(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.ValidateMediaLibraryInternal(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)

@ovosimpatico
Copy link

It's also happening for me, same issue as mentioned above with no pattern, seemingly random.

@hardwareadictos
Copy link

hardwareadictos commented May 14, 2024

Same issue here on 10.9.0/10.9.1, had to restore my backup to rollback to 10.8.13. Happening randomly and unable to fix it except restoring it to 10.8.X.

Application deployed on docker with official image.

[ERR] [43] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL GET /UserViews.
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 8: 'attempt to write a readonly database'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Emby.Server.Implementations.Data.SqliteExtensions.Execute(SqliteConnection sqliteConnection, String commandText)
   at Emby.Server.Implementations.Data.BaseSqliteRepository.GetConnection()
   at Emby.Server.Implementations.Data.SqliteItemRepository.GetItemList(InternalItemsQuery query)
   at Emby.Server.Implementations.Library.LibraryManager.GetItemList(InternalItemsQuery query, Boolean allowExternalContent)
   at MediaBrowser.Controller.Entities.Folder.QueryWithPostFiltering2(InternalItemsQuery query)
   at Emby.Server.Implementations.Library.UserViewManager.GetUserViews(UserViewQuery query)
   at Jellyfin.Api.Controllers.UserViewsController.GetUserViews(Nullable`1 userId, Nullable`1 includeExternalContent, Nullable`1[] presetViews, Boolean includeHidden)
   at lambda_method1204(Closure, Object, Object[])
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
   at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
   at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
   at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
   at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
   at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)

@prahal
Copy link

prahal commented May 14, 2024

@hardwareadictos it is enough to set parallel scan and encoding to 1 in General settings to workaround this bug (it could even be that it is already 1 for releases before 10.9). The database is not corrupted by this issue, only updates do not happen.

@hardwareadictos
Copy link

hardwareadictos commented May 14, 2024

@hardwareadictos it is enough to set parallel scan and encoding to 1 in General settings to workaround this bug (it could even be that it is already 1 for releases before 10.9). The database is not corrupted by this issue, only updates do not happen.

Well rear the first "readonly database" error i wasn't unable to make the DB work again, even restarting the whole container or recreating it, only way for "reliving" the service was either deleting the db to start from 0 or just restore the whole 10.8.13 backup.

Once the first read only database error the service was tottally down. Jellyfin unaccessible.

@ShakeSp33r
Copy link

ShakeSp33r commented May 15, 2024

Same error here. Docker. Upgraded from 10.8.13-1 to linuxserver/jellyfin:10.9.1
Host OS : Debian 11
All schedules removed & running Library scan manually. Scan failed @ 62.2%
Parallel library scan tasks limit: 0
Parallel image encoding limit: 0

[2024-05-15 08:54:57.070 +02:00] [ERR] [303] MediaBrowser.Providers.Manager.ProviderManager: Invoking "RefreshCompleted" event handlers failed
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 6: 'database table is locked'.
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.DeleteItem(Guid id)
at Emby.Server.Implementations.Library.LibraryManager.DeleteItem(BaseItem item, DeleteOptions options, BaseItem parent, Boolean notifyParentItem)
at Jellyfin.Plugin.Tvdb.Providers.TvdbMissingEpisodeProvider.DeleteVirtualItems[T](List1 existingVirtualItems) at Jellyfin.Plugin.Tvdb.Providers.TvdbMissingEpisodeProvider.HandleSeason(Season season) at Jellyfin.Plugin.Tvdb.Providers.TvdbMissingEpisodeProvider.OnProviderManagerRefreshComplete(Object sender, GenericEventArgs1 genericEventArgs)
at MediaBrowser.Providers.Manager.ProviderManager.OnRefreshComplete(BaseItem item)

Edit:

Parallel library scan tasks limit: 1
Parallel image encoding limit: 1
Library scan : Completed

@hardwareadictos
Copy link

Well, tried library scan and encoding limit both to one and i can confirm that it's stable for a couple of hours but then lockups start to appear:

Jellyfin-PRO  | Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 6: 'database table is locked: ImageInfos'.
Jellyfin-PRO  |    at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
Jellyfin-PRO  |    at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
Jellyfin-PRO  |    at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReader(RelationalCommandParameterObject parameterObject)
Jellyfin-PRO  |    at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.Enumerator.InitializeReader(Enumerator enumerator)
Jellyfin-PRO  |    at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable`1.Enumerator.MoveNext()
Jellyfin-PRO  |    at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Boolean& found)
Jellyfin-PRO  |    at lambda_method95(Closure, QueryContext)
Jellyfin-PRO  |    at Jellyfin.Server.Implementations.Users.UserManager.GetUserById(Guid id)
Jellyfin-PRO  |    at Emby.Server.Implementations.Library.UserViewManager.GetUserViews(UserViewQuery query)
Jellyfin-PRO  |    at MediaBrowser.Controller.Entities.Folder.QueryRecursive(InternalItemsQuery query)
Jellyfin-PRO  |    at MediaBrowser.Controller.Entities.UserRootFolder.GetItemsInternal(InternalItemsQuery query)
Jellyfin-PRO  |    at Jellyfin.Api.Controllers.ItemsController.GetItems(Nullable`1 userId, String maxOfficialRating, Nullable`1 hasThemeSong, Nullable`1 

Wasn't that present on the betas?

@derrezzz
Copy link

derrezzz commented May 16, 2024

I encounter exactly the same thing despite several attempts to modify parameters.
I also have this error which appears frequently:

[19:38:47] [ERR] [26] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL POST /Sessions/Playing. Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 1: 'Expression tree is too large (maximum depth 1000)'. at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db) at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements()+MoveNext() at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext() at Microsoft.Data.Sqlite.SqliteDataReader.NextResult() at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior) at Emby.Server.Implementations.Data.SqliteExtensions.ExecuteQuery(SqliteCommand command)+MoveNext() at Emby.Server.Implementations.Data.SqliteItemRepository.GetItemList(InternalItemsQuery query) at Emby.Server.Implementations.Library.LibraryManager.GetItemList(InternalItemsQuery query, Boolean allowExternalContent) at Emby.Server.Implementations.Session.SessionManager.UpdateNowPlayingItem(SessionInfo session, PlaybackProgressInfo info, BaseItem libraryItem, Boolean updateLastCheckInTime) at Emby.Server.Implementations.Session.SessionManager.OnPlaybackStart(PlaybackStartInfo info) at Jellyfin.Api.Controllers.PlaystateController.ReportPlaybackStart(PlaybackStartInfo playbackStartInfo) at lambda_method1516(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
at Jellyfin.Api.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Jellyfin.Api.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context)
`

@prahal
Copy link

prahal commented May 17, 2024

@derrezzz you should post this other issue as another bug report. This seems not related to this one.

I am getting the database lock error with library scan tasks en encoding tasks forced to "1", with the same error as OP:

[17:46:37] [INF] [73] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory /media/document_medias
[17:46:40] [INF] [3] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory /picture
[17:46:04] [ERR] [123] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteCommand.GetStatements()+MoveNext()
   at Microsoft.Data.Sqlite.SqliteDataReader.NextResult()
   at Microsoft.Data.Sqlite.SqliteCommand.ExecuteReader(CommandBehavior behavior)
   at Emby.Server.Implementations.Data.SqliteExtensions.Execute(SqliteConnection sqliteConnection, String commandText)
   at Emby.Server.Implementations.Data.BaseSqliteRepository.GetConnection()
   at Emby.Server.Implementations.Data.SqliteItemRepository.GetItemList(InternalItemsQuery query)
   at Emby.Server.Implementations.Library.LibraryManager.GetItemList(InternalItemsQuery query, Boolean allowExternalContent)
   at MediaBrowser.Controller.Entities.TV.Series.GetEpisodes(User user, DtoOptions options)
   at MediaBrowser.Providers.TV.SeriesMetadataService.RemoveObsoleteEpisodes(Series series)
   at MediaBrowser.Providers.TV.SeriesMetadataService.AfterMetadataRefresh(Series item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
   at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
   at MediaBrowser.Providers.TV.SeriesMetadataService.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
   at MediaBrowser.Controller.Entities.Folder.RefreshAllMetadataForContainer(IMetadataContainer container, MetadataRefreshOptions refreshOptions, 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.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.Controller.Entities.AggregateFolder.ValidateChildrenInternal(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.PerformLibraryValidation(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.Library.LibraryManager.ValidateMediaLibraryInternal(IProgress`1 progress, CancellationToken cancellationToken)
   at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
[17:46:43] [INF] [123] Emby.Server.Implementations.ScheduledTasks.TaskManager: Analyser la médiathèque Failed after 51 minute(s) and 12 seconds
[17:46:56] [INF] [72] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory /media/calibre

Setting these parallel tasks to "1" helped but did not prevent all parallel access to the DB. Seems it only avoided getting them all the time.

@prahal
Copy link

prahal commented May 17, 2024

Might be interesting to test if this is reproducible on Windows. Might be a dotnet for Linux bug.

@Burner1515
Copy link

Try removing your music library.

Skip this paragraph unless you are having off topic issues. I'm just leaving it here in case someone else is running through this and just plain lost in the hopes it may help. First off I am using docker on Synology and running jellyfin in a container. My upgrade failed miserably, and I did not mount /config or /cache and I did not figure out backing up the instance prior to trying to upgrade. Definitely my fault there. So blow it away and set it up, fine but media won't scan without failing quickly. I did not mount, /cache and /config. Since I did not have it before, but looks like it's key to troubleshooting. Darn, well blow it away and set jellyfin up again, this time mounting /config and /cache, but my still won't finish without failing quickly, but now I can troubleshoot and get logs easier. Found a notify watcher error, and fixed that by increasing the default to 60,000. Very weird because 32,000 was not enough, yet my old instance of jellyfin was fine without changing the low default of under 9,000. Moving on, I still can't get a good scan, just failing at like 81% over and over and quickly.

Wish I found this to try before the last steps I took. My primary error was

[ERR] [24] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
System.InvalidOperationException: Must add values for the following parameters: @type4, @value4, @CleanValue4

And of course my values of 4 did not exactly match on open web searches.

Reviewing the logs I pinpointed the problem down to during the music library scan. I tried removing the music library, but nope, jellyfin now fails because it can't find the music library. Weird since I removed it from the jellyfin GUI logged in as admin. I spent today cleaning my music library as it had a bunch of junk from over the years (.nfo, .ini, .jog, .playlist files, some apple drum .m3p or w/e files, video files, etc) and was definitely not up to best naming standards. Keep in mind, with all that terrible junk the last jellyfin release worked fine.

Anyway, I added the music library back and told it to rescan discarding the old data it just refused to give up. Got to 92% and failed still. I thought it failed at like 86%, so it was weird to see some progress with the same error, but I gave up after many scans hitting 92%. Frustrated because I can't pinpoint down the music files that are an issue, I took the last step and just rebuilt from scratch one more time but forget the music. Success.

I will not be adding the music folder back for any testing. I can't find a way to actually remove the music library after it's added in the jellyfin GUI and later removed. I saw others giving it 12 hours and having success, but it did not work for me. When I would remove the music library I would not find the corresponding music folder anymore, but the scan demanded it to continue. I'm not sure what happened with this release, but it made me much better at troubleshooting jellyfin that's for sure. I really love jellyfin, but it's definitely frustrating after how spoiled the last release (my first one to set up) made me feel lol.

@gnattu
Copy link
Member

gnattu commented May 18, 2024

Try removing your music library.

Skip this paragraph unless you are having off topic issues. I'm just leaving it here in case someone else is running through this and just plain lost in the hopes it may help. First off I am using docker on Synology and running jellyfin in a container. My upgrade failed miserably, and I did not mount /config or /cache and I did not figure out backing up the instance prior to trying to upgrade. Definitely my fault there. So blow it away and set it up, fine but media won't scan without failing quickly. I did not mount, /cache and /config. Since I did not have it before, but looks like it's key to troubleshooting. Darn, well blow it away and set jellyfin up again, this time mounting /config and /cache, but my still won't finish without failing quickly, but now I can troubleshoot and get logs easier. Found a notify watcher error, and fixed that by increasing the default to 60,000. Very weird because 32,000 was not enough, yet my old instance of jellyfin was fine without changing the low default of under 9,000. Moving on, I still can't get a good scan, just failing at like 81% over and over and quickly.

Wish I found this to try before the last steps I took. My primary error was

[ERR] [24] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task System.InvalidOperationException: Must add values for the following parameters: @type4, @value4, @CleanValue4

And of course my values of 4 did not exactly match on open web searches.

Reviewing the logs I pinpointed the problem down to during the music library scan. I tried removing the music library, but nope, jellyfin now fails because it can't find the music library. Weird since I removed it from the jellyfin GUI logged in as admin. I spent today cleaning my music library as it had a bunch of junk from over the years (.nfo, .ini, .jog, .playlist files, some apple drum .m3p or w/e files, video files, etc) and was definitely not up to best naming standards. Keep in mind, with all that terrible junk the last jellyfin release worked fine.

Anyway, I added the music library back and told it to rescan discarding the old data it just refused to give up. Got to 92% and failed still. I thought it failed at like 86%, so it was weird to see some progress with the same error, but I gave up after many scans hitting 92%. Frustrated because I can't pinpoint down the music files that are an issue, I took the last step and just rebuilt from scratch one more time but forget the music. Success.

I will not be adding the music folder back for any testing. I can't find a way to actually remove the music library after it's added in the jellyfin GUI and later removed. I saw others giving it 12 hours and having success, but it did not work for me. When I would remove the music library I would not find the corresponding music folder anymore, but the scan demanded it to continue. I'm not sure what happened with this release, but it made me much better at troubleshooting jellyfin that's for sure. I really love jellyfin, but it's definitely frustrating after how spoiled the last release (my first one to set up) made me feel lol.

Try 10.9.2

@Burner1515
Copy link

Burner1515 commented May 18, 2024

Try 10.9.2

Wow, I did not realize that happened while I was still working on this lol, you are all quick :). Much appreciated for the quick response and all you do!

Edit to change this part
I'm dumb, I should have looked closer at the spinoff issue for this that's specific to my unpassable issue. It says fixed with
Fix not binding to SQL parameters [PR https://github.com//pull/11698], by @Bond-009
In 10.9.2. I'm rebuilding one more time and hoping to have a good sync in the morning! :). Below is from my original comment.

I should also say my install was the older 10.8.13. I did not realize there was a 10.9.0, we just got the windows client update notification a couple days ago, so I thought 10.9.1 was the next release from 10.8.13.

@VigibotDev
Copy link

Do you have a fix for the scan end with error ?
"[ERR] Error executing Scheduled Task"
"[ERR] Error refreshing owned items for /path...."
"Database is locked"

@sasablazek
Copy link

Where did you find this env var? It's not in the code 🤔

Picked it here #11464

Seems that this is still under review and not merged (maybe there's a reason for it).

Are we sure that this is safe for DB integrity?

Just asking 🙂

it is just changing the journal mode. As long as memory or off mode are not used it should work fine

@gnattu
Copy link
Member

gnattu commented May 31, 2024

Please. That PR is not even merged. Stop trying that. It will not have any effect because the code is not in current release.

@sasablazek
Copy link

sasablazek commented May 31, 2024

maybe not, but for me it has the effect. When I add it as env var I don't have the database locks and library scanning completes in under 1 min. When I put back wal mode the database locks are back and scanning fails. If I leave it as wal and put Parallel library scan tasks limit = 1 then scanning works but it takes several hours to finish. Using linuxserver docker btw

@gnattu
Copy link
Member

gnattu commented May 31, 2024

library scanning completes in under 1 min

This only means it probably does not scan your library at all.

I am the person write that code, I know it would not have effect in the current release.

@sasablazek
Copy link

Ok, I agree with you.

But, it works for me for some reason and I can't explain why if there is nothing in the code that would cause this change to behave like this.
I did a quick test to make sure scanning works. I have stopped real time monitoring. Added new movie and triggered media library scan manually. It took 5 min 51 sec without any errors and successfully added new movie with all metadata. Also did it with new tv show. It took 1 min 25 sec with the same outcome.

@Emporea
Copy link

Emporea commented May 31, 2024

@sasablazek Always follow the logs while you scan the library. My scan also completes without error on the web ui but the logs still show occasional database locks:

[ERR] [20] MediaBrowser.Controller.Entities.BaseItem: Error refreshing owned items for
/movies/A Good Movie (1734)/A Good Movie.mp4
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked'.
   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[]

@VigibotDev
Copy link

Not solved for (I don't have music library) 1.9.4 always terminate scan with [failed] status.

@cvium
Copy link
Member

cvium commented Jun 2, 2024

Logs... #11589 (comment)

@VigibotDev
Copy link

I wait tomorrow to switch on debug mode log (because jellyfin is used a lot on Sunday evening)

@VigibotDev
Copy link

VigibotDev commented Jun 3, 2024

I think they are some TV Show that make the [Failed] :

[2024-06-03 08:16:31.940 +02:00] [DBG] "GetItemList" query time (slow): 58.2976ms. Query: "select type,data,EndDate,ChannelId,CommunityRating,CustomRating,IndexNumber,IsLocked,PreferredMetadataLanguage,PreferredMetadataCountryCode,Width,Height,DateLastRefreshed,Name,Path,PremiereDate,Overview,ParentIndexNumber,ProductionYear,OfficialRating,ForcedSortName,RunTimeTicks,Size,DateCreated,DateModified,guid,Genres,ParentId,Audio,IsInMixedFolder,DateLastSaved,LockedFields,Studios,Tags,TrailerTypes,OriginalTitle,PrimaryVersionId,DateLastMediaAdded,Album,LUFS,NormalizationGain,CriticRating,IsVirtualItem,SeriesName,SeasonName,SeasonId,SeriesId,PresentationUniqueKey,InheritedParentalRatingValue,ExternalSeriesId,Tagline,ProviderIds,Images,ProductionLocations,ExtraIds,TotalBitrate,ExtraType,ExternalId,SeriesPresentationUniqueKey,OwnerId from TypedBaseItems A where ParentId=@ParentId"
[2024-06-03 08:16:31.941 +02:00] [DBG] "GetItemList" query time (slow): 30.5213ms. Query: "select type,data,EndDate,ChannelId,CommunityRating,CustomRating,IndexNumber,IsLocked,PreferredMetadataLanguage,PreferredMetadataCountryCode,Width,Height,DateLastRefreshed,Name,Path,PremiereDate,Overview,ParentIndexNumber,ProductionYear,OfficialRating,ForcedSortName,RunTimeTicks,Size,DateCreated,DateModified,guid,Genres,ParentId,Audio,IsInMixedFolder,DateLastSaved,LockedFields,Studios,Tags,TrailerTypes,OriginalTitle,PrimaryVersionId,DateLastMediaAdded,Album,LUFS,NormalizationGain,CriticRating,IsVirtualItem,SeriesName,SeasonName,SeasonId,SeriesId,PresentationUniqueKey,InheritedParentalRatingValue,ExternalSeriesId,Tagline,ProviderIds,Images,ProductionLocations,ExtraIds,TotalBitrate,ExtraType,ExternalId,SeriesPresentationUniqueKey,OwnerId from TypedBaseItems A where ParentId=@ParentId"
[2024-06-03 08:16:31.943 +02:00] [DBG] "GetItemList" query time (slow): 12.7411ms. Query: "select type,data,EndDate,ChannelId,CommunityRating,CustomRating,IndexNumber,IsLocked,PreferredMetadataLanguage,PreferredMetadataCountryCode,Width,Height,DateLastRefreshed,Name,Path,PremiereDate,Overview,ParentIndexNumber,ProductionYear,OfficialRating,ForcedSortName,RunTimeTicks,Size,DateCreated,DateModified,guid,Genres,ParentId,Audio,IsInMixedFolder,DateLastSaved,LockedFields,Studios,Tags,OriginalTitle,PrimaryVersionId,DateLastMediaAdded,Album,LUFS,NormalizationGain,CriticRating,IsVirtualItem,SeriesName,SeasonName,SeasonId,SeriesId,PresentationUniqueKey,InheritedParentalRatingValue,ExternalSeriesId,Tagline,ProviderIds,Images,ProductionLocations,ExtraIds,TotalBitrate,ExtraType,ExternalId,SeriesPresentationUniqueKey,OwnerId from TypedBaseItems A where type=@type AND SeriesPresentationUniqueKey=@SeriesPresentationUniqueKey ORDER BY SortName ASC"
[2024-06-03 08:16:31.943 +02:00] [DBG] "GetItemList" query time (slow): 59.7842ms. Query: "select type,data,EndDate,ChannelId,CommunityRating,CustomRating,IndexNumber,IsLocked,PreferredMetadataLanguage,PreferredMetadataCountryCode,Width,Height,DateLastRefreshed,Name,Path,PremiereDate,Overview,ParentIndexNumber,ProductionYear,OfficialRating,ForcedSortName,RunTimeTicks,Size,DateCreated,DateModified,guid,Genres,ParentId,Audio,IsInMixedFolder,DateLastSaved,LockedFields,Studios,Tags,TrailerTypes,OriginalTitle,PrimaryVersionId,DateLastMediaAdded,Album,LUFS,NormalizationGain,CriticRating,IsVirtualItem,SeriesName,SeasonName,SeasonId,SeriesId,PresentationUniqueKey,InheritedParentalRatingValue,ExternalSeriesId,Tagline,ProviderIds,Images,ProductionLocations,ExtraIds,TotalBitrate,ExtraType,ExternalId,SeriesPresentationUniqueKey,OwnerId from TypedBaseItems A where ParentId=@ParentId"
[2024-06-03 08:16:31.944 +02:00] [DBG] "GetItemList" query time (slow): 13.7217ms. Query: "select type,data,EndDate,ChannelId,CommunityRating,CustomRating,IndexNumber,IsLocked,PreferredMetadataLanguage,PreferredMetadataCountryCode,Width,Height,DateLastRefreshed,Name,Path,PremiereDate,Overview,ParentIndexNumber,ProductionYear,OfficialRating,ForcedSortName,RunTimeTicks,Size,DateCreated,DateModified,guid,Genres,ParentId,Audio,IsInMixedFolder,DateLastSaved,LockedFields,Studios,Tags,TrailerTypes,OriginalTitle,PrimaryVersionId,DateLastMediaAdded,Album,LUFS,NormalizationGain,CriticRating,IsVirtualItem,SeriesName,SeasonName,SeasonId,SeriesId,PresentationUniqueKey,InheritedParentalRatingValue,ExternalSeriesId,Tagline,ProviderIds,Images,ProductionLocations,ExtraIds,TotalBitrate,ExtraType,ExternalId,SeriesPresentationUniqueKey,OwnerId from TypedBaseItems A where ParentId=@ParentId"
[2024-06-03 08:16:31.956 +02:00] [DBG] OnRefreshProgress f27caa37e5142225cceded48f6553502 86.5
[2024-06-03 08:16:31.956 +02:00] [DBG] OnRefreshProgress f27caa37e5142225cceded48f6553502 86.53571428571428
[2024-06-03 08:16:31.956 +02:00] [DBG] OnRefreshProgress f27caa37e5142225cceded48f6553502 86.57142857142857
[2024-06-03 08:16:31.956 +02:00] [DBG] OnRefreshProgress f27caa37e5142225cceded48f6553502 86.60714285714286
[2024-06-03 08:16:31.956 +02:00] [ERR] Error refreshing owned items for "/path/to/a/tvshow/tvshows"
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 6: 'database table is locked'.
   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 MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
[2024-06-03 08:16:31.958 +02:00] [DBG] "GetItemList" query time (slow): 41.8003ms. Query: "select type,data,EndDate,ChannelId,CommunityRating,CustomRating,IndexNumber,IsLocked,PreferredMetadataLanguage,PreferredMetadataCountryCode,Width,Height,DateLastRefreshed,Name,Path,PremiereDate,Overview,ParentIndexNumber,ProductionYear,OfficialRating,ForcedSortName,RunTimeTicks,Size,DateCreated,DateModified,guid,Genres,ParentId,Audio,IsInMixedFolder,DateLastSaved,LockedFields,Studios,Tags,TrailerTypes,OriginalTitle,PrimaryVersionId,DateLastMediaAdded,Album,LUFS,NormalizationGain,CriticRating,IsVirtualItem,SeriesName,SeasonName,SeasonId,SeriesId,PresentationUniqueKey,InheritedParentalRatingValue,ExternalSeriesId,Tagline,ProviderIds,Images,ProductionLocations,ExtraIds,TotalBitrate,ExtraType,ExternalId,SeriesPresentationUniqueKey,OwnerId from TypedBaseItems A where ParentId=@ParentId"

I try the "Search for missing metadata" on entire TV Show library before to run another Scan.
I never tried with 1.9.4 version,

Same problem:( always terminate [failed] even with "Search for missing metadata" launched and finished before.

@MoonOverMiami
Copy link

Synology Container showed an image Update available. Clicked on it and now Jellyfin won't show log in. Won't show the server. Rebooted the Synology NAS.
Grrr... What happened?
Anyone want to FTL/SSH into my NAS?

@gnattu
Copy link
Member

gnattu commented Jun 3, 2024

Synology Container showed an image Update available. Clicked on it and now Jellyfin won't show log in. Won't show the server. Rebooted the Synology NAS. Grrr... What happened? Anyone want to FTL/SSH into my NAS?

Is this your case?

#11929

@MoonOverMiami
Copy link

No. Not my case

@gnattu
Copy link
Member

gnattu commented Jun 3, 2024

Why are you so sure? Do you have any logs?

@Satadaes
Copy link

Satadaes commented Jun 3, 2024

same issue here, nothing seems to resolve it

@hardwareadictos
Copy link

At least to me, no more "database table is locked" errors since I updated yo 10.9.4 🙂

@viown
Copy link

viown commented Jun 6, 2024

"database table is locked" still occurs for me on 10.9.6, although the lockup doesn't seem to last as long as it used to.

@gnattu
Copy link
Member

gnattu commented Jun 7, 2024

@viown is it 5 or 6? A full log will be even more helpful

@gnattu
Copy link
Member

gnattu commented Jun 7, 2024

This should be fixed for most users in 10.9.6. @MoonOverMiami Are you still having this issue?

@cvium
Copy link
Member

cvium commented Jun 7, 2024

Eh, the upgrade path depends entirely on how you installed it in the first place. We expect some level of skill and knowledge about self-hosting from our users. We are not going to create videos and especially not for extremely basic stuff such as "how to upgrade".

The fix is in 10.9.6. If you want the fix, upgrade. There may be some residual issues but the nature of SQLite means there will be the occasional db lock errors as it does not like concurrency.

@VigibotDev
Copy link

10.9.6 fix for me. Thanks for amazing work now all is perfect

@hardwareadictos
Copy link

Hey guys! I have no more lockups since 10.9.4 (10.9.6 is for me the best 10.9.X release so far as it fixed most off the bugs outside those locks) but look what i found on another service which uses sqlite for media management:

Kareadita/Kavita#2985

Someone upper here suggested to enable WAL also on Jellyfin which maybe could point to a solution.

Maybe that's not the correct forum, but would be nice also that Jellyfin Devs start to consider let users to use 3rd party more robust DBs like Mysql or Pstgres like Nextcloud does.

Have a nice day.

@gnattu
Copy link
Member

gnattu commented Jun 7, 2024

Someone upper here suggested to enable WAL also on Jellyfin which maybe could point to a solution.

We already enabled that. But that can only help us this much. SQLite concurrency is still limited and all the locking you are seeing is due to the concurrency.

@hardwareadictos
Copy link

Someone upper here suggested to enable WAL also on Jellyfin which maybe could point to a solution.

We already enabled that. But that can only help us this much. SQLite concurrency is still limited and all the locking you are seeing is due to the concurrency.

So it is enabled by default now? That could explain in my personal case why locks disappeared in my server....

@gnattu
Copy link
Member

gnattu commented Jun 7, 2024

Someone upper here suggested to enable WAL also on Jellyfin which maybe could point to a solution.

We already enabled that. But that can only help us this much. SQLite concurrency is still limited and all the locking you are seeing is due to the concurrency.

So it is enabled by default now? That could explain in my personal case why locks disappeared in my server....

It is enabled since the very first 10.9 version. It can only help that much and cannot avoid all lockings when concurrency is high and query is slow.

@viown
Copy link

viown commented Jun 7, 2024

@viown is it 5 or 6? A full log will be even more helpful

10.9.6. I've attached the full logs below.

jellyfin.txt

@gnattu
Copy link
Member

gnattu commented Jun 7, 2024

@viown is it 5 or 6? A full log will be even more helpful

10.9.6. I've attached the full logs below.

jellyfin.txt

This is not the library database being locked but the device one. The pending #11901 might fix your issue. As a current workaround, can you try set env variable JELLYFIN_SQLITE__disableSecondLevelCache=true to see if it improves things?

@Cwavs
Copy link

Cwavs commented Jun 7, 2024

I can confirm 10.9.6 fixed it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Needs Testing
Development

No branches or pull requests