Skip to content

fix(actors): Recreate actor object when Dapr reports a new activation - #1876

Open
cicoyle wants to merge 6 commits into
dapr:masterfrom
cicoyle:fix-sidecar-restart-overwrite-actor
Open

cicoyle wants to merge 6 commits into
dapr:masterfrom
cicoyle:fix-sidecar-restart-overwrite-actor

Conversation

@cicoyle

@cicoyle cicoyle commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Pairs with the dapr/dapr change that 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, skipped onActivate and kept its in-memory fields.

  • new id: onDeactivate 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 deleted object still runs onPostActorMethod, then skips the save and fails with IllegalStateException
  • a late first activation never replaces a newer one, a different id fails
  • ActorRuntime and DaprController get overloads with the id, old signatures still work
  • HTTP only, this SDK has no gRPC actor callback stream

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

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.

…ctivation

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 21:04

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.

@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.

#1840 added the gRPC actor event stream after this branched. ActorEventDispatcher on master calls runtime.invoke, invokeReminder and invokeTimer without the activation id, so stream-hosted actors keep the stale object. Can you rebase and pass the id from request.getMetadata() there?

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Copilot AI balanced review requested due to automatic review settings October 27, 2026 15:52

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.

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Copilot AI balanced review requested due to automatic review settings October 27, 2026 17:18

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.

Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Copilot AI balanced review requested due to automatic review settings October 29, 2026 14:55

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.

@codecov

codecov Bot commented Oct 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.75177% with 43 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.94%. Comparing base (84aa4d7) to head (70e51ad).

Files with missing lines Patch % Lines
...java/io/dapr/actors/runtime/ActorStateManager.java 71.79% 23 Missing and 10 partials ⚠️
.../java/io/dapr/actors/runtime/ActivationIdGate.java 90.38% 2 Missing and 3 partials ⚠️
...in/java/io/dapr/actors/runtime/DaprClientImpl.java 0.00% 3 Missing ⚠️
...a/io/dapr/actors/runtime/ActorEventDispatcher.java 90.90% 0 Missing and 1 partial ⚠️
...main/java/io/dapr/actors/runtime/ActorManager.java 98.70% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1876      +/-   ##
============================================
+ Coverage     80.69%   80.94%   +0.25%     
- Complexity     2851     2922      +71     
============================================
  Files           275      276       +1     
  Lines          8459     8591     +132     
  Branches        911      930      +19     
============================================
+ Hits           6826     6954     +128     
+ Misses         1266     1265       -1     
- Partials        367      372       +5     

☔ 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants