Jellyfin Forum
Media scan fails at the end in 10.9.x - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: Media scan fails at the end in 10.9.x (/t-media-scan-fails-at-the-end-in-10-9-x)



Media scan fails at the end in 10.9.x - Iskelderon - 2024-05-18

Whenever I want to do a full scan of my libraries (I use mixed video libraries on a mostly per-country basis), the final step now always is a database error message, but the server continues to run just fine after that. I can see that the task is then marked with a red "(Failed)" and whatever work it wanted to do in that final step, is probably lost when it couldn't access the database correctly.
Code:
[2024-05-18 17:23:04.419 +02:00] [INF] [74] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "E:\Video_other\CN"
[2024-05-18 17:23:04.419 +02:00] [INF] [40] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "E:\Video_other\D"
[2024-05-18 17:23:04.419 +02:00] [INF] [13] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "E:\Video"
[2024-05-18 17:23:04.419 +02:00] [INF] [46] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "E:\Video_other\J"
[2024-05-18 17:23:04.419 +02:00] [INF] [65] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "E:\Video_other\K"
[2024-05-18 17:23:04.419 +02:00] [INF] [36] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "F:\Audiobooks"
[2024-05-18 17:23:04.420 +02:00] [INF] [75] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "F:\Video"
[2024-05-18 17:23:04.420 +02:00] [INF] [55] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "F:\Video_other\D"
[2024-05-18 17:23:04.420 +02:00] [INF] [31] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "D:\Libation Books\Books"
[2024-05-18 17:23:04.420 +02:00] [INF] [96] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "G:\Audio"
[2024-05-18 17:23:04.420 +02:00] [INF] [86] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "F:\Video_other\J"
[2024-05-18 17:23:04.420 +02:00] [INF] [48] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "G:\Audiobooks"
[2024-05-18 17:23:04.420 +02:00] [INF] [57] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "G:\Video"
[2024-05-18 17:23:04.420 +02:00] [INF] [37] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "G:\Video_other\ESP"
[2024-05-18 17:23:04.420 +02:00] [INF] [21] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "G:\Video_other\D"
[2024-05-18 17:23:04.420 +02:00] [INF] [41] Emby.Server.Implementations.IO.LibraryMonitor: Watching directory "G:\Video_other\NL"
[2024-05-18 17:23:04.420 +02:00] [ERR] [66] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
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.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.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)



RE: Media scan fails at the end in 10.9.x - mcgregormx - 2024-05-18

This won't be a helpful response in the sense that I have a solution to fix this, but my experience has been the same(ish). In the last 5 days I've been troubleshooting a similar issue, as well as other issues; I even did a completely new install (docker) and while my trickplay issue appeared to be resolved (I wasn't able enable trickplay in the library settings) I couldn't complete a library scan; It kept saying my database file was locked, then it would fail. I did an upgrade from 10.8.13 to 10.9.1 (skipped 10.9.0) and haven't been able to get things to work at all. Sadly, I just barely restored back to my 10.8.13 version, and am back up and running.


RE: Media scan fails at the end in 10.9.x - TheDreadPirate - 2024-05-18

Is Jellyfin's database on a hard drive or an SSD?


RE: Media scan fails at the end in 10.9.x - Iskelderon - 2024-05-19

(2024-05-18, 10:49 PM)TheDreadPirate Wrote: Is Jellyfin's database on a hard drive or an SSD?

On a harddrive, the way it bloats itself right now with the wonky Trickplay integration and other factors there's no use moving it to my SSD that's also my C: drive.


RE: Media scan fails at the end in 10.9.x - TheDreadPirate - 2024-05-19

I'm wondering if the hard drive just isn't able to keep up. I recall other users experiencing this even with 10.8 when users put the database on a HDD.

Trickplays are not that large. It increased my jellyfin data dir from about 7GB to 14GB for 250 movies and 4400 episodes. We're not talking about hundreds of GB.


RE: Media scan fails at the end in 10.9.x - Iskelderon - 2024-05-19

(2024-05-19, 01:08 AM)TheDreadPirate Wrote: I'm wondering if the hard drive just isn't able to keep up.  I recall other users experiencing this even with 10.8 when users put the database on a HDD.

Trickplays are not that large.  It increased my jellyfin data dir from about 7GB to 14GB for 250 movies and 4400 episodes.  We're not talking about hundreds of GB.

I'll have to look into moving it to a different drive "tomorrow" (or rather today, after getting some sleep).
Right now it's 3 in the morning over here and Jellyfin is constantly croaking with "database locked" errors now also if I decide to add missing metadata, after it suddenly decided to lose metadata for a ton of content (only for ones that only have the MovieDB ID in the folder name, ones with the IMDB ID as well continue to work). 10.9.x has brought several fixes for other problems and the database connection pooling also makes it more comfortable to handle, but in many ways it has just become a pain in the ass in different ways.


RE: Media scan fails at the end in 10.9.x - Iskelderon - 2024-05-19

Ok, moving it tot the SSD as it continues to bloat (already at 39 GB as the trickplay task has reset itself to 19.9%) and setting a symlink for Jellyfin's ProgramData folder at least worked as a workaround. Not sure everyone else running into these "database locked" errors will have that luxury.