Repository navigation
Conversation
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
…ctivation Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1876 +/- ##
============================================
+ Coverage 79.69% 80.71% +1.02%
- Complexity 2687 2876 +189
============================================
Files 267 274 +7
Lines 7933 8467 +534
Branches 842 911 +69
============================================
+ Hits 6322 6834 +512
- Misses 1255 1266 +11
- Partials 356 367 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nelson-parente
left a comment
There was a problem hiding this comment.
#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?
| } | ||
|
|
||
| /** Logs errors so a failed cleanup doesn't fail the call. */ | ||
| private Mono<Void> deactivateDiscarded(ActorId actorId, T actor) { |
There was a problem hiding this comment.
The discarded actor's onDeactivate can still save state, which brings back the overwrite this PR is meant to stop.
onDeactivateInternal clears the state cache and then calls the user's onDeactivate. Nothing stops that override from calling getActorStateManager().set(...) and then saveState(). A common pattern is to keep a counter in a field and write it on deactivation. After a daprd restart another host may have committed a newer value, and when the new activation id arrives (line 86), the stale actor writes its old value over it.
Suggest making a discarded actor refuse saves, for example a flag set here before onDeactivateInternal and checked in ActorStateManager.save() (which covers both saveState() and a direct getActorStateManager().save()). That keeps onDeactivate available for releasing resources without letting it write.
Signed-off-by: Cassandra Coyle <cassie@diagrid.io>
Pairs with the dapr/dapr change that sends
Dapr-Actor-Activation-Idon 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.
IllegalStateExceptionActorRuntimeandDaprControllerget overloads with the id, old signatures still workNot covered: a save already in flight can still land late. Etags on actor state are a follow-up.