LibraryManager item cache serves stale metadata across replicas #19
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context: multi-replica stateless deployment (two 2-replica apps,
cheeztvandfafflix, each one PostgreSQL plus valkey, no sticky sessions). Not a 12.0 regression — live in the deployed build. Tracking: #12.Problem
Emby.Server.Implementations/Library/LibraryManager.cs:90—GetItemByIdis cache-first with no freshness check against the database.A pod that cached an item before a metadata or artwork correction keeps serving the stale version. The staleness window is bounded only by
CacheSizeeviction, which on a large library is a long time. Wrong titles, descriptions and images persist on some replicas and not others, so a refresh that "fixes" an item appears to randomly un-fix itself.Degradation rather than corruption — no data is lost.
Proposal
The same invalidation mechanism as #13 (
UserDataManager): a concurrency token compared on read, or valkey pub/sub on item save. These two are likely one piece of work — do them together.Acceptance
GetItemByIdwithout a restart.PostgreSqlTestServerintests/Jellyfin.Server.Testsand runs in thepostgres-migration-chainWoodpecker step (JELLYFIN_TEST_POSTGRES). In-memory providers have hidden different semantics and are how three bugs reached production.