jellyfin / jellyfin-plugin-kodisyncqueue

https://jellyfin.org
GNU General Public License v2.0
44 stars 13 forks source link

jellyfin server : library sync - Maximum number of transactions reached #83

Closed prahal closed 4 months ago

prahal commented 4 months ago

Jellyfin 10.9.0 (though this issue might have existed before, only with 10.9.0 the logs are not constantly filling and I was able to notice this one).

I believe this happened when I triggered the metadata refresh of my movie folder of which there are around 650.

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:
[17:02:18] [INF] [63] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: Started library sync
[17:02:18] [ERR] [63] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: An error has occurred in LibraryUpdateTimerCallback
LiteDB.LiteException: Maximum number of transactions reached
   at LiteDB.Engine.TransactionMonitor.GetTransaction(Boolean create, Boolean queryOnly, Boolean& isNew)
   at LiteDB.Engine.QueryExecutor.ExecuteQuery(Boolean executionPlan)
   at LiteDB.Engine.LiteEngine.Query(String collection, Query query)
   at LiteDB.LiteQueryable`1.ToDocuments()+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo.WriteLibrarySync(IEnumerable`1 items, ItemStatus status)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.UpdateLibrary(IReadOnlyCollection`1 items, ItemStatus status)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.PushChangesToDb(IReadOnlyCollection`1 itemsAdded, IReadOnlyCollection`1 itemsUpdated, IReadOnlyCollection`1 itemsRemoved)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.LibraryUpdateTimerCallback(Object state)
cryodream commented 4 months ago

Same here. Running Jellyfin in a lsio container on unRAID. After updating to 10.9.0 this exact same exception. Updating to 10.9.1 - did not help - same exception.

[2024-05-12 21:27:20.889 -04:00] [INF] [179] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Scan Media Library" Completed after 2 minute(s) and 19 seconds
[2024-05-12 21:27:30.100 -04:00] [ERR] [41] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: An error has occurred in LibraryUpdateTimerCallback
LiteDB.LiteException: Maximum number of transactions reached
   at LiteDB.Engine.TransactionMonitor.GetTransaction(Boolean create, Boolean queryOnly, Boolean& isNew)
   at LiteDB.Engine.QueryExecutor.ExecuteQuery(Boolean executionPlan)
   at LiteDB.Engine.LiteEngine.Query(String collection, Query query)
   at LiteDB.LiteQueryable`1.ToDocuments()+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo.WriteLibrarySync(IEnumerable`1 items, ItemStatus status)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.UpdateLibrary(IReadOnlyCollection`1 items, ItemStatus status)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.PushChangesToDb(IReadOnlyCollection`1 itemsAdded, IReadOnlyCollection`1 itemsUpdated, IReadOnlyCollection`1 itemsRemoved)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.LibraryUpdateTimerCallback(Object state)
abbekeff commented 4 months ago

Also getting this after upgrading 10.9.1, error in LibraryUpdateTimerCallback, maybe related ? Running in docker on debian

[2024-05-14 09:53:56.946 +02:00] [ERR] [89] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: An error has occurred in LibraryUpdateTimerCallback
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Threading.ReaderWriterLockSlim'.
   at System.Threading.ReaderWriterLockSlim.TryEnterReadLockCore(TimeoutTracker timeout)
   at LiteDB.Engine.LockService.EnterTransaction()
   at LiteDB.Engine.TransactionMonitor.GetTransaction(Boolean create, Boolean queryOnly, Boolean& isNew)
   at LiteDB.Engine.QueryExecutor.ExecuteQuery(Boolean executionPlan)
   at LiteDB.Engine.LiteEngine.Query(String collection, Query query)
   at LiteDB.LiteQueryable`1.ToDocuments()+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo.WriteLibrarySync(IEnumerable`1 items, ItemStatus status)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.UpdateLibrary(IReadOnlyCollection`1 items, ItemStatus status)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.PushChangesToDb(IReadOnlyCollection`1 itemsAdded, IReadOnlyCollection`1 itemsUpdated, IReadOnlyCollection`1 itemsRemoved)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.LibraryUpdateTimerCallback(Object state)

Also "UserUpdateTimerCallback"

[2024-05-14 09:53:31.905 +02:00] [INF] [98] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.UserSyncNotification: Started user data sync
[2024-05-14 09:53:32.060 +02:00] [ERR] [98] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.UserSyncNotification: An error has occurred in UserUpdateTimerCallback
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Threading.ReaderWriterLockSlim'.
   at System.Threading.ReaderWriterLockSlim.TryEnterReadLockCore(TimeoutTracker timeout)
   at LiteDB.Engine.LockService.EnterTransaction()
   at LiteDB.Engine.TransactionMonitor.GetTransaction(Boolean create, Boolean queryOnly, Boolean& isNew)
   at LiteDB.Engine.QueryExecutor.ExecuteQuery(Boolean executionPlan)
   at LiteDB.Engine.LiteEngine.Query(String collection, Query query)
   at LiteDB.LiteQueryable`1.ToDocuments()+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo.<>c__DisplayClass10_0.<SetUserInfoSync>b__0(UserItemDataDto dto)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo.SetUserInfoSync(List`1 dtos, List`1 itemRefs, String userId)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.UserSyncNotification.SaveUserChanges(List`1 dtos, List`1 itemRefs, String userName, String userId)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.UserSyncNotification.SendNotifications(IEnumerable`1 changes, List`1 itemRefs, CancellationToken cancellationToken)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.UserSyncNotification.UpdateTimerCallback(Object state)
lldsolitude commented 4 months ago

Also getting this after upgrading 10.9.1, error in LibraryUpdateTimerCallback, maybe related ? Running in docker on debian

[2024-05-14 09:53:56.946 +02:00] [ERR] [89] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: An error has occurred in LibraryUpdateTimerCallback
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Threading.ReaderWriterLockSlim'.
   at System.Threading.ReaderWriterLockSlim.TryEnterReadLockCore(TimeoutTracker timeout)
   at LiteDB.Engine.LockService.EnterTransaction()
   at LiteDB.Engine.TransactionMonitor.GetTransaction(Boolean create, Boolean queryOnly, Boolean& isNew)
   at LiteDB.Engine.QueryExecutor.ExecuteQuery(Boolean executionPlan)
   at LiteDB.Engine.LiteEngine.Query(String collection, Query query)
   at LiteDB.LiteQueryable`1.ToDocuments()+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo.WriteLibrarySync(IEnumerable`1 items, ItemStatus status)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.UpdateLibrary(IReadOnlyCollection`1 items, ItemStatus status)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.PushChangesToDb(IReadOnlyCollection`1 itemsAdded, IReadOnlyCollection`1 itemsUpdated, IReadOnlyCollection`1 itemsRemoved)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.LibraryUpdateTimerCallback(Object state)

Also "UserUpdateTimerCallback"

[2024-05-14 09:53:31.905 +02:00] [INF] [98] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.UserSyncNotification: Started user data sync
[2024-05-14 09:53:32.060 +02:00] [ERR] [98] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.UserSyncNotification: An error has occurred in UserUpdateTimerCallback
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Threading.ReaderWriterLockSlim'.
   at System.Threading.ReaderWriterLockSlim.TryEnterReadLockCore(TimeoutTracker timeout)
   at LiteDB.Engine.LockService.EnterTransaction()
   at LiteDB.Engine.TransactionMonitor.GetTransaction(Boolean create, Boolean queryOnly, Boolean& isNew)
   at LiteDB.Engine.QueryExecutor.ExecuteQuery(Boolean executionPlan)
   at LiteDB.Engine.LiteEngine.Query(String collection, Query query)
   at LiteDB.LiteQueryable`1.ToDocuments()+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo.<>c__DisplayClass10_0.<SetUserInfoSync>b__0(UserItemDataDto dto)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo.SetUserInfoSync(List`1 dtos, List`1 itemRefs, String userId)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.UserSyncNotification.SaveUserChanges(List`1 dtos, List`1 itemRefs, String userName, String userId)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.UserSyncNotification.SendNotifications(IEnumerable`1 changes, List`1 itemRefs, CancellationToken cancellationToken)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.UserSyncNotification.UpdateTimerCallback(Object state)

I'm getting this error too and Kodi does not automatically sync content anymore.

axionman commented 4 months ago

Same thing here since the last 2 Jellyfin server updates:

[15:37:01] [ERR] [15] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: An error has occurred in LibraryUpdateTimerCallback
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Threading.ReaderWriterLockSlim'.
   at System.Threading.ReaderWriterLockSlim.TryEnterReadLockCore(TimeoutTracker timeout)
   at LiteDB.Engine.LockService.EnterTransaction()
   at LiteDB.Engine.TransactionMonitor.GetTransaction(Boolean create, Boolean queryOnly, Boolean& isNew)
   at LiteDB.Engine.QueryExecutor.ExecuteQuery(Boolean executionPlan)
   at LiteDB.Engine.LiteEngine.Query(String collection, Query query)
   at LiteDB.LiteQueryable`1.ToDocuments()+MoveNext()
   at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.TryGetFirst[TSource](IEnumerable`1 source, Boolean& found)
   at Jellyfin.Plugin.KodiSyncQueue.Data.DbRepo.WriteLibrarySync(IEnumerable`1 items, ItemStatus status)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.UpdateLibrary(IReadOnlyCollection`1 items, ItemStatus status)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.PushChangesToDb(IReadOnlyCollection`1 itemsAdded, IReadOnlyCollection`1 itemsUpdated, IReadOnlyCollection`1 itemsRemoved)
   at Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification.LibraryUpdateTimerCallback(Object state)
oddstr13 commented 4 months ago

Introduced by #78

Multiple upstream issue reports for the «Maximum number of transactions reached» error

mbdavid/LiteDB#2436 is listed as a likely fix

Some report downgrading LiteDB to 5.0.17 fixing that particular issue.

The «Cannot access a disposed object» error looks like a separate issue, not directly related.

nothing2obvi commented 4 months ago

Experiencing the same problem.

bestouff commented 4 months ago

More than 1000 films. Same problem. Debian packages.

crobibero commented 4 months ago

Please try plugin v11

bestouff commented 4 months ago

Yes @crobibero I can't see the error anymore. Well done !

h3llrais3r commented 4 months ago

The error seems gone in the logs from th jellyfin server, but the sync is still not working in kodi...:(

cryodream commented 4 months ago

@h3llrais3r For me, after upgrading the plugin, the sync worked, but not fully. It synced some changed, but missed the others. I did a library reset in Kodi using the Jellyfin plugin settings. Reset the DB, reset the images, but did not reset the the plugin settings. After Kodi restarted, the sync took about 45 minutes (I have a huge library) and everything seems to work a OK. It was fast, easy and painless.

h3llrais3r commented 4 months ago

The plugin still gives errors at my side, see comment https://github.com/jellyfin/jellyfin-kodi/issues/861#issuecomment-2114252457

(I did not do a reset)

crobibero commented 4 months ago

The plugin still gives errors at my side, see comment jellyfin/jellyfin-kodi#861 (comment)

(I did not do a reset)

That is a Kodi plugin issue, not a Jellyfin plugin issue.

Closing this issue as it is resolved.

h3llrais3r commented 4 months ago

That is a Kodi plugin issue, not a Jellyfin plugin issue.

Correct, this was just one part of the issue at server side, which is solved. The follow up for the client side issue for the sync is continued in https://github.com/jellyfin/jellyfin-kodi/issues/861