:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(postgres): retry a control-plane proxy hiccup during connect (#115887)
Tom Owers6b9b15ae57e2
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/postgres.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/postgres.pyindex d0a6ff3fece8..2ef1eb08a058 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/postgres.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/postgres.py@@ -327,6 +327,15 @@ _CONNECTION_DROPPED_ERROR_SUBSTRINGS = (# ("password authentication failed", "SASL authentication failed"), and exclude the volatile# millisecond value."authentication did not complete within",+ # A Neon-style proxy reports its own internal round trip to the control plane (used to route,+ # authenticate, or wake the compute while establishing the connection) failing with the bare,+ # generic "ERROR: Control plane request failed" — unlike the specific, actionable control-plane+ # rejections already handled in `get_non_retryable_errors` (exceeded quota, allow-listed IP,+ # disabled branch, ...), which all carry their own detailed wording. The generic form means the+ # round trip itself broke (a transient blip reaching the control plane), not that it returned a+ # customer-fixable rejection, so a fresh connect after backoff typically succeeds — the same+ # transient class as the scale-to-zero wake timeout above.+ "control plane request failed",# Supavisor authenticates a tenant with no static user record by running an `auth_query` against# the tenant's own backend database to fetch/cache the password secret used to validate the# client's credentials. If that secret isn't cached yet (e.g. right after Supavisor startsdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.pyindex f47db5c05ad8..b8268edc2dea 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/postgres/test_postgres.py@@ -2483,6 +2483,19 @@ class TestIsConnectionDroppedError:psycopg.errors.ConnectionFailure("Failed to connect to database: authentication did not complete within 15000ms"),+ # A Neon-style proxy's own round trip to its control plane fails with the bare, generic+ # "ERROR: Control plane request failed" — distinct from the specific, actionable+ # control-plane rejections (quota exceeded, allow-listed IP, ...) that stay non-retryable+ # in `get_non_retryable_errors`. The generic form means the round trip itself broke, not+ # that it returned a customer-fixable rejection, so the reconnect must catch it. The real+ # production message pairs it with the generic plaintext-fallback rejection on a second+ # line, which must not block the match.+ psycopg.OperationalError(+ 'connection failed: connection to server at "203.0.113.40", port 5432 failed: ERROR: '+ "Control plane request failed\n"+ 'connection to server at "203.0.113.40", port 5432 failed: ERROR: connection is '+ "insecure (try using `sslmode=require`)"+ ),# Supavisor's own auth_query secret lookup (used to authenticate a tenant with no static# user record) times out waiting for the backend, reporting a bare OperationalError# carrying its "(EAUTHQUERY)" code. A race in the pooler's bookkeeping, not a credential