You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Postgres: GET /api/v1/request deadlocks when two admission keys share a slot #681
On Postgres (v3.72.31, same code in v3.72.32), opening the requests page as an admin can freeze SeerrNG. After that, Download Sync logs Scheduled job is already running every minute, scans and settings saves hang, there is no error, and only a restart helps.
Cause
GET /api/v1/request takes a lease via acquireAuthorizedUserSecurityMutation (key user-security:user:1). The lease holds its admission slot until the handler ends.
The handler then calls runWithCurrentServarrService('radarr', 0, …) (key service-config:radarr:0).
This call runs outside the lease's AsyncLocalStorage context, so the coordinator asks for a new slot.
Both keys hash to slot 5 of 8. The second call waits for the lease, and the lease waits for the handler, so neither ever finishes.
It happens when the page lists a movie request with serverId and profileId set.
Evidence
One session stays idle in transaction after pg_advisory_xact_lock. Its lock key matches hashtextextended('user-security:user:1', 0).
It came back 9 s after a restart, when a browser tab reloaded the page.
idle_in_transaction_session_timeout kills the session, but the app stays stuck because the wait is in the AsyncLock, not in a query.
Changing DB_POOL_SIZE, and therefore the slot count, cannot avoid every collision.
Possible fixes
Run the handler inside the lease's context, so the Radarr call reuses its transaction.
Or fetch the Servarr profiles outside the lease. They are only used for display.
Or add a timeout to slot acquisition, so the request fails with an error instead of hanging forever.
Fixed on main by 1b9bb80c1. The request handler now releases its user-security admission lease after loading the request rows and before display-only Servarr profile lookups, avoiding PostgreSQL admission-slot deadlocks. The focused request-list regression test passed (1/1); the exact-main security, browser, Lumen, Semgrep, and Trivy workflows are running: Security regression tests, Lumen validation, Semgrep, Trivy.
Activity
snapetech commentedon Nov 13, 2026
Fixed on
mainby1b9bb80c1. The request handler now releases its user-security admission lease after loading the request rows and before display-only Servarr profile lookups, avoiding PostgreSQL admission-slot deadlocks. The focused request-list regression test passed (1/1); the exact-main security, browser, Lumen, Semgrep, and Trivy workflows are running: Security regression tests, Lumen validation, Semgrep, Trivy.fix(requests): release read lease before profile lookups