Skip to content

Reset stale actor objects using the daprd activation id - #1347

Open
cicoyle wants to merge 4 commits into
dapr:mainfrom
cicoyle:fix-sidecar-restart-overwrite-actor
Open

cicoyle wants to merge 4 commits into
dapr:mainfrom
cicoyle:fix-sidecar-restart-overwrite-actor

Conversation

@cicoyle

@cicoyle cicoyle commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Pairs with dapr/dapr#10748, which sends Dapr-Actor-Activation-Id on actor callbacks.

After daprd is killed the app keeps its actor objects, and the new daprd never sends DELETE for them. The SDK reused the stale object and its next save could overwrite newer state.

  • new id: _on_deactivate the old object (errors logged), activate a fresh one
  • same id or no id (older daprd): reuse, same as today
  • a call on a replaced or deactivated object still runs _on_post_actor_method, then skips the save and fails
  • a late activation never replaces a newer one, a different id fails
  • id read case-insensitively from FastAPI, Flask and the gRPC stream, empty values skipped
  • dispatch, fire_reminder and fire_timer take an optional activation_id, public API unchanged

Not covered: a save already in flight can still land late. Etags on actor state are a follow-up.

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
@cicoyle
cicoyle requested review from a team as code owners October 26, 2026 20:20
Copilot AI balanced review requested due to automatic review settings October 26, 2026 20:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@CasperGN CasperGN self-assigned this Oct 26, 2026
…-overwrite-actor

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>

# Conflicts:
#	tests/actor/test_grpc_host.py
@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.27536% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 88.61%. Comparing base (e25982b) to head (93162f1).

Files with missing lines Patch % Lines
dapr/clients/base.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1347      +/-   ##
==========================================
+ Coverage   88.18%   88.61%   +0.43%     
==========================================
  Files         165      165              
  Lines       13432    13537     +105     
==========================================
+ Hits        11845    11996     +151     
+ Misses       1587     1541      -46     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

nelson-parente
nelson-parente previously approved these changes Oct 26, 2026

@nelson-parente nelson-parente left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The validate-dapr-head failure is the durabletask e2e "no workflow worker is connected" race, unrelated.

Comment thread dapr/actor/runtime/manager.py
Comment thread dapr/actor/runtime/manager.py Outdated
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants