: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(data-imports): treat pooler shutdown as a transient db error (#87010)
Tom Owers4da9f9522425
diff --git a/posthog/temporal/common/db_errors.py b/posthog/temporal/common/db_errors.pyindex 797943d63570..e5eaffcee139 100644--- a/posthog/temporal/common/db_errors.py+++ b/posthog/temporal/common/db_errors.py@@ -29,6 +29,11 @@ _TRANSIENT_DB_ERROR_MARKERS = (# unexpectedly" marker above, just detected client-side instead of reported by the server.# Reaches us standalone too, not only wrapped in the cached-login message above."server conn crashed",+ # The pooler (pgbouncer/pgcat) itself draining for a restart or deploy, refusing new+ # connections while it does. Same self-healing shape as "the database system is shutting+ # down" above, just raised by the pooler in front of Postgres rather than Postgres itself.+ # A connect failure through a pooler, so no SQLSTATE — falls through to this message match.+ "pooler is shutting down",)# SQLSTATE class 57P (operator intervention): the server is shutting down or restarting anddiff --git a/posthog/temporal/common/test_db_errors.py b/posthog/temporal/common/test_db_errors.pyindex 97ef1d26d582..49e9c9e0896e 100644--- a/posthog/temporal/common/test_db_errors.py+++ b/posthog/temporal/common/test_db_errors.py@@ -27,6 +27,13 @@ class _WithSqlstate(Exception):# The dead-socket message on its own, without pgbouncer's cached-login wrapper — the case# the marker above doesn't cover.(OperationalError("server conn crashed?"), True),+ (+ OperationalError(+ 'connection failed: connection to server at "10.0.0.1", port 6543 failed: '+ "FATAL: pooler is shutting down"+ ),+ True,+ ),(OperationalError("connection failed: FATAL: password authentication failed for user"), False),(OperationalError("no such database"), False),],