: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(ingestion): retry transient ECONNRESET errors in the postgres layer (#61877)
Paweł Ledwoń049b8ba2055b
diff --git a/nodejs/src/utils/db/postgres.ts b/nodejs/src/utils/db/postgres.tsindex decdffa2c9f9..3fb860d0fae3 100644--- a/nodejs/src/utils/db/postgres.ts+++ b/nodejs/src/utils/db/postgres.ts@@ -51,6 +51,7 @@ const POSTGRES_UNAVAILABLE_ERROR_MESSAGES = ['getaddrinfo EAI_AGAIN','Connection terminated unexpectedly','ECONNREFUSED',+ 'ECONNRESET', // Connection reset by peer, e.g. PgBouncer/PG closed an idle or in-flight connection'ETIMEDOUT','query_wait_timeout', // Waiting on PG bouncer to give us a slot'server login has been failing', // PgBouncer cannot authenticate with upstream PGdiff --git a/nodejs/tests/utils/db/postgres.test.ts b/nodejs/tests/utils/db/postgres.test.tsindex b70fb5f330d8..f022faa47e82 100644--- a/nodejs/tests/utils/db/postgres.test.ts+++ b/nodejs/tests/utils/db/postgres.test.ts@@ -11,6 +11,7 @@ describe('isTransientPgError', () => {['getaddrinfo EAI_AGAIN pg'],['Connection terminated unexpectedly'],['connect ECONNREFUSED 127.0.0.1:5432'],+ ['read ECONNRESET'],['connect ETIMEDOUT 10.0.0.1:5432'],['query_wait_timeout'],['server login has been failing, try again later (server_login_retry)'],@@ -45,6 +46,7 @@ describe('handlePostgresError', () => {['getaddrinfo EAI_AGAIN pg'],['Connection terminated unexpectedly'],['connect ECONNREFUSED 127.0.0.1:5432'],+ ['read ECONNRESET'],['connect ETIMEDOUT 10.0.0.1:5432'],['query_wait_timeout'],['server login has been failing, try again later (server_login_retry)'],