[PR #14746] [MERGED] Attach before updating/deleting to avoid DbUpdateConcurrencyException #14094

Closed
opened 2026-02-07 07:24:18 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/14746
Author: @evan314159
Created: 9/5/2025
Status: Merged
Merged: 9/20/2025
Merged by: @crobibero

Base: masterHead: fix-users-update-delete


📝 Commits (3)

  • 746c1da Refresh user record before updating/deleting to avoid DbUpdateConcurrencyException
  • 816a12e use ExecuteDeleteAsync instead of FindAsync & Remove
  • f6197e5 register user in change tracker instead of finding in database first

📊 Changes

1 file changed (+3 additions, -1 deletions)

View changed files

📝 Jellyfin.Server.Implementations/Users/UserManager.cs (+3 -1)

📄 Description

Changes
Attach user before updating/deleting to avoid DbUpdateConcurrencyException

Issue
[16:35:17] [ERR] [91] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL DELETE /Users/3f18f29e944c43f0b75981be1190b046. Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See https://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/14746 **Author:** [@evan314159](https://github.com/evan314159) **Created:** 9/5/2025 **Status:** ✅ Merged **Merged:** 9/20/2025 **Merged by:** [@crobibero](https://github.com/crobibero) **Base:** `master` ← **Head:** `fix-users-update-delete` --- ### 📝 Commits (3) - [`746c1da`](https://github.com/jellyfin/jellyfin/commit/746c1daa64da2062fdf1a3d5acd1fef211afee3e) Refresh user record before updating/deleting to avoid DbUpdateConcurrencyException - [`816a12e`](https://github.com/jellyfin/jellyfin/commit/816a12e04019dd93676b48f55e739966e9ef6e9c) use ExecuteDeleteAsync instead of FindAsync & Remove - [`f6197e5`](https://github.com/jellyfin/jellyfin/commit/f6197e52579c65130dd46d73d8a02c3cd5403f01) register user in change tracker instead of finding in database first ### 📊 Changes **1 file changed** (+3 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `Jellyfin.Server.Implementations/Users/UserManager.cs` (+3 -1) </details> ### 📄 Description **Changes** Attach user before updating/deleting to avoid DbUpdateConcurrencyException **Issue** [16:35:17] [ERR] [91] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL DELETE /Users/3f18f29e944c43f0b75981be1190b046. Microsoft.EntityFrameworkCore.DbUpdateConcurrencyException: The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded. See https://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 07:24:18 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#14094