fix(workflow): gracefully handle 'actor is closed' gRPC error in workflow monitor - #714
Open
praneshnikhar wants to merge 3 commits into
Open
fix(workflow): gracefully handle 'actor is closed' gRPC error in workflow monitor#714praneshnikhar wants to merge 3 commits into
praneshnikhar wants to merge 3 commits into
Conversation
…flow monitor The _await_and_log_state background task can encounter an _InactiveRpcError with 'actor is closed' when the workflow actor is deactivated during scale-to-zero while monitoring is in progress. This is a transient, non-fatal condition. Previously this was logged as a full exception traceback at ERROR level. Now it is caught specifically and logged as a WARNING with a clear explanation, so operators are not alarmed by expected behavior. Closes: dapr#520 Signed-off-by: praneshnikhar <praneshnikhar@gmail.com>
praneshnikhar
force-pushed
the
fix-520-actor-closed-error
branch
from
August 5, 2026 12:15
da90149 to
e43ce11
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces operational noise in WorkflowRunner by treating the transient gRPC “actor is closed” condition (common during scale-to-zero/deactivation) as a non-fatal monitoring interruption rather than an error-level exception.
Changes:
- Adds a special-case handler in
_await_and_log_stateto downgrade the “actor is closed” monitoring failure toWARNING. - Preserves
ERROR/traceback logging for all other monitoring exceptions.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+600
to
+616
| except Exception as exc: | ||
| import grpc | ||
|
|
||
| if ( | ||
| isinstance(exc, grpc._channel._InactiveRpcError) | ||
| and "actor is closed" in exc.details() | ||
| ): | ||
| logger.warning( | ||
| "[%s] %s: workflow monitor interrupted because the actor was deactivated " | ||
| "(expected during scale-to-zero). Outcome will be checked on next poll.", | ||
| self._name, | ||
| instance_id, | ||
| ) | ||
| else: | ||
| logger.exception( | ||
| f"[{self._name}] {instance_id}: error while monitoring workflow outcome", | ||
| ) |
Comment on lines
+603
to
+612
| if ( | ||
| isinstance(exc, grpc._channel._InactiveRpcError) | ||
| and "actor is closed" in exc.details() | ||
| ): | ||
| logger.warning( | ||
| "[%s] %s: workflow monitor interrupted because the actor was deactivated " | ||
| "(expected during scale-to-zero). Outcome will be checked on next poll.", | ||
| self._name, | ||
| instance_id, | ||
| ) |
Collaborator
|
@praneshnikhar could you pls see the PR feedback 🙏 |
Author
hey gimme sometime working on it! |
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.
Description
The
_await_and_log_statebackground task can encounter a gRPC_InactiveRpcErrorwith details "actor is closed, cannot handledeactivated" when the workflow actor is deactivated (scale-to-zero)
while the fire-and-forget monitor is still polling for completion.
This is a transient, non-fatal condition — the workflow itself
continues executing successfully. Previously it was logged as a
full exception traceback at
ERRORlevel, which alarmed operatorsunnecessarily.
Changes
_InactiveRpcErrorwith "actor is closed" in_await_and_log_stateand log atWARNINGwith a clearexplanation instead of
ERROR.ERRORas before.Before
After
Fixes #520