Skip to content

: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.

fix(temporal): treat pgbouncer backend crash as a transient db blip (#83890)

Tom Owersb8445bfe71b8
diff --git a/posthog/temporal/common/db_errors.py b/posthog/temporal/common/db_errors.py
index a9a027d9d2ba..797943d63570 100644
--- a/posthog/temporal/common/db_errors.py
+++ b/posthog/temporal/common/db_errors.py
@@ -10,6 +10,12 @@ _TRANSIENT_DB_ERROR_MARKERS = (
"query_wait_timeout",
"server closed the connection unexpectedly",
"connection reset by peer",
+ # pgbouncer's report that the backend connection assigned to an in-flight query died before
+ # answering. Same self-healing dropped-connection condition as the closed/reset markers above,
+ # just detected by the pooler rather than by the client. psycopg raises it as ProtocolViolation
+ # (SQLSTATE 08P01), which is too broad to whitelist by class because a genuine protocol
+ # violation is a driver bug that must keep reaching error tracking, so match the message.
+ "server conn crashed?",
"the database system is starting up",
"the database system is shutting down",
# pgbouncer's server_login_retry cooldown: a backend connect attempt failed, so pgbouncer