Repository navigation
Description
Following up on the review discussion with @CasperGN in #1370:
Expected Behavior
In TaskHubGrpcClient._call_with_transient_retry (and its async counterpart in AsyncTaskHubGrpcClient), when an unbounded orchestration wait (wait_for_workflow_completion with timeout=None or 0) has been in-flight and healthy for a substantial duration, any transient server error in _TRANSIENT_RPC_CODES (including StatusCode.UNAVAILABLE and StatusCode.FAILED_PRECONDITION caused by sidecar restart) should refresh the 30-second transient grace window (_MAX_TRANSIENT_RETRY_SECONDS = 30.0), giving the restarting Dapr sidecar time to recover.
Actual Behavior
The healthy-wait grace-window refresh currently checks only for StatusCode.CANCELLED:
if unbounded:
if code == grpc.StatusCode.CANCELLED and call_duration >= 1.0:
if consecutive_resets < self._MAX_CONSECUTIVE_TRANSIENT_RESETS:
consecutive_resets += 1
transient_deadline = None
backoff = 0.5When a Dapr sidecar (daprd) restarts or is terminated during an in-flight wait, gRPC frequently surfaces the disconnection as StatusCode.UNAVAILABLE ("transport closing" / "connection refused") or StatusCode.FAILED_PRECONDITION.
Because code == StatusCode.CANCELLED evaluates to False:
transient_deadlineis not refreshed.- If the previous in-flight wait lasted longer than 30 seconds (
call_duration >= 30.0s), the checktime.monotonic() >= transient_deadlineevaluates toTrueon the very first attempt. - The client immediately raises
grpc.RpcError(StatusCode.UNAVAILABLE)instead of backing off and allowing the sidecar its 30-second restart window.
Steps to Reproduce the Problem
- Start an unbounded workflow wait:
client.wait_for_workflow_completion(instance_id, timeout=None)on a workflow that takes longer than 30 seconds. - Terminate or restart
daprdafter ~35 seconds while the wait is held. - The gRPC transport returns
StatusCode.UNAVAILABLE. - Observe that the client immediately crashes with
grpc.RpcErrorinstead of retrying across the 30-second transient grace window.
Code Pointers & Proposed Fix
dapr/ext/workflow/_durabletask/client.py: Lines 520–545dapr/ext/workflow/_durabletask/aio/client.py: Lines 420–445
- Broaden the healthy-wait reset check from
code == grpc.StatusCode.CANCELLEDtocode in _TRANSIENT_RPC_CODES. - Extract the hardcoded
1.0shealthy-wait threshold into a named constant (e.g.,_HEALTHY_WAIT_THRESHOLD_SECONDS = 1.0) shared across sync and async clients. - Add unit tests covering sidecar restart producing
UNAVAILABLEafter an in-flight wait > 30s.
cc @CasperGN
Release Note
RELEASE NOTE: FIX Refresh transient retry grace window on UNAVAILABLE and FAILED_PRECONDITION during in-flight workflow waits.
Activity
itzzdev09 commentedon Nov 25, 2026
I'd like to take this one, covering both
TaskHubGrpcClientandAsyncTaskHubGrpcClient, unless someone is already on it.itzzdev09 commentedon Nov 25, 2026
Heads up: the healthy-wait
CANCELLEDrefresh this issue refers to (call_duration,consecutive_resets) is in #1370, which isn't merged, so there's nothing onmainto change yet. I'll pick this up once #1370 lands, if it's still open then.NaniToka commentedon Nov 29, 2026
Thanks for the interest, @itzzdev09! I'm already working on this one as a follow-up to #1370, so feel free to pick up another issue. Appreciate it!
NaniToka commentedon Nov 29, 2026
/assign