: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(clickhouse): classify a pyarrow mid-stream truncation as retryable (#99028)
Tom Owers2bf77ee04e57
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.pyindex 30566dd07d45..b969d06464b0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/source.py@@ -363,6 +363,14 @@ class ClickHouseSource(SimpleSource[ClickHouseSourceConfig], SSHTunnelMixin, Val# `_get_client`'s in-process retry never sees it; Temporal's activity retry# reopens a fresh tunnel + client and resumes from the last committed cursor."Connection broken: IncompleteRead",+ # pyarrow raises this `OSError` from its own IPC framing (not urllib3) when the+ # connection carrying `query_arrow_stream` closes mid-message: the Arrow message+ # header already promised a body length, and the stream delivered fewer bytes+ # than that before ending. Same mid-transfer connection drop as+ # "Connection broken: IncompleteRead" above, just detected one layer up, in+ # pyarrow's message reader instead of urllib3. The byte counts vary; the+ # "bytes for message body, got" wording is stable.+ "bytes for message body, got",# requests/urllib3 raises this when the server accepts the connection but never# answers within our timeout — typically ClickHouse Cloud still cold-resuming an# idle service past our `METADATA_QUERY_TIMEOUT_SECONDS` allowance. Not indiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/test_clickhouse.py b/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/test_clickhouse.pyindex 97c5de968976..bcbb94cc4ef0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/test_clickhouse.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/clickhouse/test_clickhouse.py@@ -730,6 +730,9 @@ class TestClickHouseSourceRetryableErrors:"('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))","('Connection broken: IncompleteRead(12345 bytes read, 67 more expected)', ""IncompleteRead(12345 bytes read, 67 more expected))",+ # pyarrow's own IPC reader detects the same kind of mid-stream connection drop,+ # one layer above urllib3, and raises OSError instead. Byte counts vary.+ "Expected to be able to read 5226856 bytes for message body, got 5056408",# The server accepted the connection but never answered within our timeout —# typically ClickHouse Cloud still cold-resuming past our allowance."Error HTTPSConnectionPool(host='play.clickhouse.com', port=8443): Read timed out. "