Repository navigation
Conversation
With conn_max_age set to 0, the default, the pool closed every connection on release. The embedded proxy outpost loads the session from PostgreSQL on each authenticated request, so every request opened a new connection. Keep idle connections for 5 seconds instead, hold no minimum, and check a connection before reusing it.
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #28406 +/- ##
==========================================
- Coverage 93.80% 93.77% -0.03%
==========================================
Files 1262 1262
Lines 91705 91705
Branches 5752 5752
==========================================
- Hits 86023 85997 -26
- Misses 5596 5622 +26
Partials 86 86
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Playwright e2eDownload this run's HTML report and traces, then open the report: gh run download 46876271709 -D playwright-artifacts
npx playwright show-report playwright-artifacts/playwright-reportInstallation instructionsInstructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-0404e96e91dd6669e266f7434a54d9b9b586a326
# Distroless image: AUTHENTIK_TAG=gh-0404e96e91dd6669e266f7434a54d9b9b586a326-distroless
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-0404e96e91dd6669e266f7434a54d9b9b586a326
# Distroless image: tag: gh-0404e96e91dd6669e266f7434a54d9b9b586a326-distrolessAfterwards, run the upgrade commands from the latest release notes. |
Details
What does this PR change?
When
postgresql.conn_max_ageis0(the default), the Rust connection pool now keeps idle connections for 5 seconds instead of closing each one on release. It holds no minimum connection and checks a connection before reusing it. The pool is still capped at 4 connections.Why is this change needed?
The embedded proxy outpost loads the session from PostgreSQL on every authenticated request. With close-on-release, each forward-auth or proxied request opened a new connection (connect, auth,
SET, query, close).Measured locally on a release build with PostgreSQL 18 and password auth, on an authenticated
/outpost.goauthentik.io/auth/nginxrequest:The close-on-release behavior came from #22679, which fixed a pool spin. This change doesn't bring the spin back. Idle CPU stayed flat and pooled connections were gone after the idle timeout.
How was this tested?
pg_terminate_backend; the following requests all returned 200. Withouttest_before_acquire, the first one returned 401.Linked issues
refs #22679
Checklist
make all)make docs)