From f7d80ae9e6c977bdae6a417e5c5e7debb6aad18d Mon Sep 17 00:00:00 2001 From: JPVenson Date: Thu, 14 May 2026 12:54:35 +0000 Subject: [PATCH 1/3] backport changes from #16835 --- Emby.Server.Implementations/Session/SessionManager.cs | 4 ++-- .../JellyfinDbContext.cs | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.cs index 2eeeecfec0..767293afe1 100644 --- a/Emby.Server.Implementations/Session/SessionManager.cs +++ b/Emby.Server.Implementations/Session/SessionManager.cs @@ -271,9 +271,9 @@ namespace Emby.Server.Implementations.Session user.LastActivityDate = activityDate; await _userManager.UpdateUserAsync(user).ConfigureAwait(false); } - catch (DbUpdateConcurrencyException e) + catch (DbUpdateConcurrencyException) { - _logger.LogDebug(e, "Error updating user's last activity date."); + _logger.LogDebug("Error updating user's last activity date due to concurrency conflict. This is an expected event."); } } } diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs index 5163bff8b6..ef147d5b33 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs @@ -268,6 +268,11 @@ public class JellyfinDbContext(DbContextOptions options, ILog }).ConfigureAwait(false); return result; } + catch (DbUpdateConcurrencyException) + { + // a concurrency exception is supposed to be always handled by the invoker of the method, logging it here is only causing log bloat. + throw; + } catch (Exception e) { logger.LogError(e, "Error trying to save changes."); @@ -289,6 +294,11 @@ public class JellyfinDbContext(DbContextOptions options, ILog }); return result; } + catch (DbUpdateConcurrencyException) + { + // a concurrency exception is supposed to be always handled by the invoker of the method, logging it here is only causing log bloat. + throw; + } catch (Exception e) { logger.LogError(e, "Error trying to save changes."); From b278dcf475c8914b40d9cc166753254c427f69bc Mon Sep 17 00:00:00 2001 From: JPVenson Date: Thu, 14 May 2026 13:08:24 +0000 Subject: [PATCH 2/3] revert change --- .../Jellyfin.Database.Implementations/JellyfinDbContext.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs index ef147d5b33..14c4207c90 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs @@ -294,11 +294,6 @@ public class JellyfinDbContext(DbContextOptions options, ILog }); return result; } - catch (DbUpdateConcurrencyException) - { - // a concurrency exception is supposed to be always handled by the invoker of the method, logging it here is only causing log bloat. - throw; - } catch (Exception e) { logger.LogError(e, "Error trying to save changes."); From 5f3189af41f951c530c99a8e59249850add3f693 Mon Sep 17 00:00:00 2001 From: JPVenson Date: Thu, 14 May 2026 13:09:00 +0000 Subject: [PATCH 3/3] readded concurrency exception check --- .../Jellyfin.Database.Implementations/JellyfinDbContext.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs b/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs index 14c4207c90..ef147d5b33 100644 --- a/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs +++ b/src/Jellyfin.Database/Jellyfin.Database.Implementations/JellyfinDbContext.cs @@ -294,6 +294,11 @@ public class JellyfinDbContext(DbContextOptions options, ILog }); return result; } + catch (DbUpdateConcurrencyException) + { + // a concurrency exception is supposed to be always handled by the invoker of the method, logging it here is only causing log bloat. + throw; + } catch (Exception e) { logger.LogError(e, "Error trying to save changes.");