Repository navigation
Open
dapr/python-sdk
#1357Labels
enhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is needed
Description
The workflow monitor raises an unhandled gRPC error while the workflow is still executing successfully. The error is non-fatal but noisy.
== APP - diagram-agent == INFO:durabletask-worker:231e8453401c4f8289df69b845e3e85f: Orchestrator yielded with 1 task(s) and 0 event(s) outstanding.
== APP - diagram-agent == ERROR:dapr_agents.workflow.runners.base:[agent-runner] 231e8453401c4f8289df69b845e3e85f: error while monitoring workflow outcome
== APP - diagram-agent == Traceback (most recent call last):
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/dapr_agents/workflow/runners/base.py", line 563, in _await_and_log_state
== APP - diagram-agent == state = await self._await_state(
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/dapr_agents/workflow/runners/base.py", line 543, in _await_state
== APP - diagram-agent == return await asyncio.to_thread(_wait)
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/threads.py", line 25, in to_thread
== APP - diagram-agent == return await loop.run_in_executor(None, func_call)
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 58, in run
== APP - diagram-agent == result = self.fn(*self.args, **self.kwargs)
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/dapr_agents/workflow/runners/base.py", line 537, in _wait
== APP - diagram-agent == return self._wf_client.wait_for_workflow_completion(
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/dapr/ext/workflow/dapr_workflow_client.py", line 199, in wait_for_workflow_completion
== APP - diagram-agent == state = self.__obj.wait_for_orchestration_completion(
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/durabletask/client.py", line 224, in wait_for_orchestration_completion
== APP - diagram-agent == res: pb.GetInstanceResponse = self._stub.WaitForInstanceCompletion(
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/grpc/_interceptor.py", line 276, in __call__
== APP - diagram-agent == response, ignored_call = self._with_call(
== APP - diagram-agent == ^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/grpc/_interceptor.py", line 331, in _with_call
== APP - diagram-agent == return call.result(), call
== APP - diagram-agent == ^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/grpc/_channel.py", line 438, in result
== APP - diagram-agent == raise self
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/grpc/_interceptor.py", line 314, in continuation
== APP - diagram-agent == response, call = self._thunk(new_method).with_call(
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/opentelemetry/instrumentation/grpc/grpcext/_interceptor.py", line 92, in with_call
== APP - diagram-agent == return self._interceptor.intercept_unary(
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/opentelemetry/instrumentation/grpc/_client.py", line 190, in intercept_unary
== APP - diagram-agent == return self._intercept(request, metadata, client_info, invoker)
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/opentelemetry/instrumentation/grpc/_client.py", line 171, in _intercept
== APP - diagram-agent == raise exc
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/opentelemetry/instrumentation/grpc/_client.py", line 157, in _intercept
== APP - diagram-agent == result = invoker(request, metadata)
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/opentelemetry/instrumentation/grpc/grpcext/_interceptor.py", line 82, in invoker
== APP - diagram-agent == return self._base_callable.with_call(
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/grpc/_channel.py", line 1173, in with_call
== APP - diagram-agent == return _end_unary_response_blocking(state, call, True, None)
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == File "/Users/eileenyu/programming/diagram-agent/.venv/lib/python3.12/site-packages/grpc/_channel.py", line 990, in _end_unary_response_blocking
== APP - diagram-agent == raise _InactiveRpcError(state) # pytype: disable=not-instantiable
== APP - diagram-agent == ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
== APP - diagram-agent == grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
== APP - diagram-agent == status = StatusCode.UNKNOWN
== APP - diagram-agent == details = "actor is closed, cannot handle deactivated"
== APP - diagram-agent == debug_error_string = "UNKNOWN:Error received from peer ipv4:34.248.40.116:443 {grpc_message:"actor is closed, cannot handle deactivated", grpc_status:2}"
== APP - diagram-agent == >
== APP - diagram-agent == 2026-03-12 17:15:45.591 durabletask-worker INFO: 231e8453401c4f8289df69b845e3e85f: Orchestrator yielded with 1 task(s) and 0 event(s) outstanding.
== APP - diagram-agent == INFO:durabletask-worker:231e8453401c4f8289df69b845e3e85f: Orchestrator yielded with 1 task(s) and 0 event(s) outstanding.
== APP - diagram-agent == INFO:dapr_agents.llm.utils.request:Tools are available in the request.
Expected: Retry or gracefully handle the deactivation instead of raising.
Versions: dapr-agents 0.13.0 and 1.0.0rc1, dapr SDK 1.17.x, Python 3.12
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is needed
Activity
JeffreyJPZ commentedon Apr 3, 2026
Hi, I'm not sure if this is supposed to be a bug, but I tried to do a little bit of digging into this.
If we trace through the Python workflow SDK, waiting for workflow completion is a unary RPC (see the workflow client code here). Tracing through the workflow engine and workflow actor code, it looks like its handled by this method which eventually blocks if the workflow isn't complete:
dapr/pkg/actors/targets/workflow/orchestrator/stream.goThe actual
"deactivated"error seems to be caused by thisDeactivatemethod in the workflow actor code:dapr/pkg/actors/targets/workflow/orchestrator/orchestrator.goIf we look at all the references, this is called indirectly by
HaltAll/HaltNonHostedand some lifecycle methods (purging workflows/cleanup on workflow completion):dapr/pkg/actors/targets/workflow/orchestrator/factory.godapr/pkg/actors/targets/workflow/orchestrator/orchestrator.goThe logs show that the workflow is definitely not complete, so my best guess is that its related somehow to actor deactivation (
HaltAll/HaltNonHostedare used for actor placement rebalancing?). The docs also mention that idle workflow actors can be deactivated/unloaded from memory (e.g. after scheduling activities), so it could also be related to that (not sure exactly where that occurs though). If this is the case should the client swallow the error and just wait again here?praneshnikhar commentedon Jul 29, 2026
heyy i haved fixed the issue and created a PR
fix(workflow): gracefully handle 'actor is closed' gRPC error in work…