You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[WORKFLOW SDK BUG] In-flight wait grace window fails to refresh on UNAVAILABLE or FAILED_PRECONDITION after healthy wait #1378
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:
When 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_deadline is not refreshed.
If the previous in-flight wait lasted longer than 30 seconds (call_duration >= 30.0s), the check time.monotonic() >= transient_deadline evaluates to True on 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 daprd after ~35 seconds while the wait is held.
The gRPC transport returns StatusCode.UNAVAILABLE.
Observe that the client immediately crashes with grpc.RpcError instead of retrying across the 30-second transient grace window.
Broaden the healthy-wait reset check from code == grpc.StatusCode.CANCELLED to code in _TRANSIENT_RPC_CODES.
Extract the hardcoded 1.0s healthy-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 UNAVAILABLE after an in-flight wait > 30s.
Heads up: the healthy-wait CANCELLED refresh this issue refers to (call_duration, consecutive_resets) is in #1370, which isn't merged, so there's nothing on main to change yet. I'll pick this up once #1370 lands, if it's still open then.
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.