fix: retry transport-sourced Cancelled errors and count them in metrics - #1269
Merged
Sushisource merged 8 commits intoMay 18, 2026
Merged
Sushisource merged 8 commits into
Sushisource merged 8 commits into
Conversation
When Code::Cancelled originates from a transport-level failure (tonic::transport::Error → hyper::Error, e.g. connection closed during an AZ outage), the SDK now treats it as Unavailable-class and retries using the standard bounded backoff budget instead of the previous single-retry goaway workaround. This prevents silent activity completion drops during sustained network turbulence, where the one-shot retry would exhaust immediately against a still-dead connection and the completion would be silently dropped with only a warn! log. Additionally, transport-level failures that never produce a grpc-status HTTP header are now counted in the request_failure metric with a status_code=TRANSPORT_ERROR label, making them visible in dashboards. Fixes temporalio#1252
brucearctor
force-pushed
the
fix/transport-cancelled-retry-and-metrics
branch
from
May 14, 2026 03:44
4bc1818 to
d821fac
Compare
Sushisource
reviewed
May 14, 2026
Sushisource
left a comment
Member
There was a problem hiding this comment.
Just some minor comment cleanup. Thanks a lot for this, the idea is a good one.
Co-authored-by: Spencer Judge <sjudge@hey.com>
Co-authored-by: Spencer Judge <sjudge@hey.com>
Contributor
Author
|
committed/accepted suggestions. Thanks @Sushisource ! |
Contributor
Author
|
I can't rerun, but seems like flaky CI test? |
Sushisource
approved these changes
May 18, 2026
This was referenced Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When
Code::Cancelledoriginates from a transport-level failure (tonic::transport::Error→hyper::Error, e.g. connection closed during an AZ outage), the SDK now treats it asUnavailable-class and retries using the standard bounded backoff budget instead of the previous single-retry goaway workaround.Additionally, transport-level failures that never produce a
grpc-statusHTTP header are now counted in therequest_failuremetric with astatus_code=TRANSPORT_ERRORlabel.Fixes #1252
Problem
Three compounding issues cause silent activity completion drops during sustained network turbulence:
One-shot retry limit: The goaway-cancel workaround in
retry.rsonly allows a single retry. During sustained outages (not a single GOAWAY frame), that one retry burns immediately against a still-dead connection.Silent drop: After the retry exhausts,
activities.rscatches the forwarded error and logswarn!("Network error while completing activity")— no metric, no callback, no error propagation.Metrics blind spot:
GrpcMetricSvc::call()only incrementsrequest_failurewhen it can parse agrpc-statusheader from the HTTP response. Transport-killed calls returnErr(...)at the HTTP level, so the counter is never incremented.Changes
crates/client/src/retry.rshave_retried_goaway_cancelflag withis_transport_cancelled()— a helper that inspects the error source chain fortonic::transport::Error→hyper::ErrorCancellederrors now flow through the standard backoff budget (same asUnavailable)crates/client/src/metrics.rssvc_request_failed_transport()method withstatus_code=TRANSPORT_ERRORlabelGrpcMetricSvc::call()now countsErr(...)responses (transport failures) in addition toOk(...)responses with non-OK grpc-status headersTesting
-D warnings