: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): keep a dead-connection InterfaceError out of error tracking (#102061)
Tom Owersa72c51747558
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 67af2eedabb4..a24d5e1a9bcf 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@@ -68,6 +68,13 @@ class MSSQLSource(SQLSource[MSSQLSourceConfig], SSHTunnelMixin, ValidateDatabase# 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",+ # pymssql's own InterfaceError, raised when `Cursor.execute` calls `cancel()` to+ # clear pending results and finds the connection already dead (`assert_connected`+ # in pymssql's `_mssql.pyx`). It's the same underlying DBPROCESS-death class as the+ # 20017 case above — the driver's own retry loop tried to reuse a connection that+ # died between opening and the query running — just surfaced through a different+ # internal code path. A fresh connection from the next Temporal retry resolves it.+ "Not connected to any MS SQL server",}def get_non_retryable_errors(self) -> dict[str, str | None]:diff --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 9f461ce9b595..e97defcfc27d 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@@ -794,9 +794,12 @@ class TestMSSQLSourceRetryableErrors:"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'"),+ # pymssql's own InterfaceError, raised when a query runs on a connection that died+ # between opening and use (see `MSSQLSource.get_retryable_errors`).+ pymssql.InterfaceError("Not connected to any MS SQL server"),],)- def test_unexpected_eof_is_retryable(self, error):+ def test_transient_connection_errors_are_retryable(self, error):retryable = MSSQLSource().get_retryable_errors()assert any(pattern.lower() in str(error).lower() for pattern in retryable), str(error)