: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(data-warehouse): ride out temporalio rpc timeout expired errors (#72270)
Tom Owersfe9629385870
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/temporalio.py b/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/temporalio.pyindex 9c84bfd5b094..98fb74b13ed0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/temporalio.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/temporalio.py@@ -70,7 +70,13 @@ _RETRYABLE_RPC_STATUSES = frozenset({RPCStatusCode.RESOURCE_EXHAUSTED, RPCStatus# rather than one of the transient statuses above. It's a connection blip, not the server# rejecting the request, so ride it out the same way. Match the stable transport phrase, not the# whole UNKNOWN status, so genuine server-side UNKNOWN failures still surface.-_RETRYABLE_RPC_MESSAGES = ("h2 protocol error",)+#+# tonic's timeout layer cancels a call that outruns the core client's per-request RPC deadline and+# surfaces it as status CANCELLED with the message "Timeout expired" — a client-side timeout on a+# single read (ListWorkflowExecutions / GetWorkflowExecutionHistory), not the server rejecting the+# request. It's the client-side analog of the DEADLINE_EXCEEDED case above, so ride it out too.+# Match the phrase rather than the whole CANCELLED status so a genuine cancellation still surfaces.+_RETRYABLE_RPC_MESSAGES = ("h2 protocol error", "Timeout expired")def _is_retryable_rpc_error(error: RPCError) -> bool:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/test_temporalio.py b/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/test_temporalio.pyindex 34b59daf5d37..0bab1e7c1b80 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/test_temporalio.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/temporalio/test_temporalio.py@@ -114,6 +114,9 @@ class TestTransientRPCRetry:# A mid-stream HTTP/2 transport interruption surfaces as UNKNOWN, not one of the# transient statuses above — it must still be ridden out in-process.("h2 protocol error: error reading a body from connection", RPCStatusCode.UNKNOWN),+ # tonic cancels a call that outruns the client's RPC deadline with status CANCELLED and+ # message "Timeout expired" — a client-side timeout that must be ridden out, not raised.+ ("Timeout expired", RPCStatusCode.CANCELLED),],)@patch(@@ -163,6 +166,8 @@ class TestTransientRPCRetry:("workflow execution not found for", RPCStatusCode.NOT_FOUND),# UNKNOWN alone must not be retried — only UNKNOWN carrying a transport signature is.("internal server error", RPCStatusCode.UNKNOWN),+ # CANCELLED alone must not be retried — only the "Timeout expired" phrase qualifies.+ ("Cancelled by caller", RPCStatusCode.CANCELLED),],)@patch(