HA: in-process single-instance assumptions under multi-replica deployment (tracking) #12
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?
Problem
This fork runs Jellyfin as multiple stateless pods in Kubernetes: two 2-replica deployments,
cheeztvandfafflix, each sharing one PostgreSQL plus a valkey. Sticky sessions are deliberately not used — the deployment is stateless as much as possible.Several subsystems still hold in-process state that assumes a single instance. Effects range from silent user-visible data loss to duplicated background work and stale UI. None of these are regressions from the Jellyfin 12.0 upgrade — all are live in the currently deployed build.
Proposal
Work the issues below in this order. Some share a fix or a prerequisite; those links are repeated on the issues themselves.
UserDataManagercache causes lost updates across replicas. Silent data loss, in production now.GatedTaskKeysrun on every replica. Cheap, large win.LibraryManageritem cache serves stale metadata across replicas. Likely one piece of work with #13.Jellyfin.Database.Tests.PostgreSQLis not run in CI and has 3 failing tests.DeviceIdwritesdevice.txtnon-atomically on a shared volume.Related, in the build repo: unkin/jellyfin-ha#11 documents the HA env-var contract.
Every multi-replica fix here is verified against real PostgreSQL with two independently constructed instances, using
PostgreSqlTestServerintests/Jellyfin.Server.Testsand thepostgres-migration-chainWoodpecker step (JELLYFIN_TEST_POSTGRES). In-memory providers have hidden different semantics and are how three bugs reached production.Acceptance
Every linked issue is closed, or explicitly deferred with a recorded reason.
Same class, different location: #27 covers the SSO plugin holding OAuth state in-process (third-party plugin, not Jellyfin itself), so it is tracked separately rather than as a child of this issue.