#1051 Permission checks that run on the api event loop can block it for up to POOL_TIMEOUT with a 1-connection auth pool
Description
EditEARS SPEC:
- The api shall run every synchronous auth library call (Authorization reads and writes) off the event loop (asyncio.to_thread or equivalent), so a wait for the auth pool never blocks other requests in the same hypercorn worker.
- While one auth check holds the only auth connection, other requests in that process that need no permission check (for example GET/HEAD /api/v1/health) shall still answer within 200 ms.
FOUND in #1045 review 2026-10-22: some handlers call auth synchronously on the loop thread (api/blueprints/v1/users.py:114, rbac_info.py:48, tenants.list_tenants, users_helpers._list_tenant_users) while middleware checks run in to_thread. With AUTH_DATABASE_POOL_SIZE 1, MAX_OVERFLOW 0 and api POOL_TIMEOUT 5 s (SPECS/925-cutover.patch), an on-loop call that waits for the connection stalls the whole worker for up to 5 s. Must land before the pg-nano cutover.
Comments
Loading comments...
Context
Loading context...
Audit History
View AllLoading audit history...