: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(mssql): suppress transient EOF-from-server errors from error tracking (#90964)
Tom Owers3eca7321a413
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/source.pyindex 24e8eddbde7f..0f35eeb2d6f7 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/source.py@@ -61,6 +61,15 @@ class MSSQLSource(SQLSource[MSSQLSourceConfig], SSHTunnelMixin, ValidateDatabasedef source_type(self) -> ExternalDataSourceType:return ExternalDataSourceType.MSSQL+ def get_retryable_errors(self) -> set[str]:+ return {+ # DB-Lib error 20017 — the SQL Server closed the TCP connection during query+ # execution (server restart, query timeout, or a brief network interruption).+ # A fresh connection from the next Temporal retry resolves it; keep it out of+ # error tracking so it doesn't surface as noise.+ "Unexpected EOF from the server",+ }+def get_non_retryable_errors(self) -> dict[str, str | None]:return {# Azure SQL error 40615 — the server-level firewall rejected PostHog's client IP. Thisdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/tests/test_mssql.py b/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/tests/test_mssql.pyindex 87411f4a3aba..04da731bb1d0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/tests/test_mssql.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/mssql/tests/test_mssql.py@@ -730,6 +730,26 @@ class TestMSSQLSourceNonRetryableErrors:assert any(pattern in str(exc_info.value) for pattern in non_retryable.keys())+class TestMSSQLSourceRetryableErrors:+ @pytest.mark.parametrize(+ "error",+ [+ # Real pymssql shape: DB-Lib error 20017 carried as (code, bytes) args.+ pymssql.OperationalError(+ 20017, b"DB-Lib error message 20017, severity 9:\nUnexpected EOF from the server\n"+ ),+ # The SQL-Server-message rendering of the same EOF.+ pymssql.OperationalError(+ "SQL Server message 20017, severity 9, state 0, procedure b'\\x00', line 0:\n"+ "b'DB-Lib error message 20017, severity 9:\\nUnexpected EOF from the server\\n'"+ ),+ ],+ )+ def test_unexpected_eof_is_retryable(self, error):+ retryable = MSSQLSource().get_retryable_errors()+ assert any(pattern.lower() in str(error).lower() for pattern in retryable), str(error)++class TestMSSQLSourceValidateCredentials:@pytest.fixturedef source(self):