Repository navigation
Conversation
Port the turn-based concurrency and cancellation-safe locking from dotnet-sdk#1937 and go-sdk#865 to the Rust SDK. - Add ActorTurnLock to manage per-(actor_type, actor_id) FIFO turn acquisition and reentrancy. - Wrap actor execution in actor_turn_middleware so that caller disconnects or cancellations do not release the turn lock prematurely before method execution finishes. - Support reentrancy matching via Dapr-Reentrancy-Id once activation has completed. - Add unit and integration regression tests verifying FIFO serial execution, cancellation turn holding, and HTTP reentrancy. Closes dapr#353 Signed-off-by: NaniToka <tokananiy@gmail.com>
NaniToka
force-pushed
the
fix/actor-turn-lock
branch
from
November 16, 2026 15:04
935cfd1 to
5c688e4
Compare
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
Port the per-actor turn locking from dotnet-sdk#1937 and go-sdk#865 to resolve turn overlaps when requests are canceled in flight.
Problem
In the Dapr actor model, actor invocations are expected to be single-threaded (sequential per actor ID). Previously in rust-sdk, incoming Axum actor requests (
/actors/{actor_type}/{actor_id}/method/..., timers, reminders, deactivation) executed without an application-side turn lock.When a caller disconnected or cancelled a request, daprd freed the turn while the app-side method was still executing. The next scheduled call would then run concurrently on the same actor ID, violating single-threaded turn guarantees and risking state inconsistency.
Changes
ActorTurnLock&ActorTurnLease(dapr/src/server/actor/runtime/turn_lock.rs):(actor_type, actor_id)with FIFO queue waiters.Dapr-Reentrancy-Idonce actor activation has succeeded.dapr/src/server/http.rs):/actors/{actor_type}/{actor_id}/...endpoints inactor_turn_middleware.ActorTurnLease. Even if the client connection drops or the outer request future is cancelled, local turn ownership is preserved until the invocation runs to completion.ReentrancyConfigto actor models and runtime registration so actors can enable reentrancy and declare reentrancy limits.lease.allow_reentrancy()only afterget_or_create_actoractivation has finished.Dapr-Reentrancy-Idexecute without deadlock.Issue reference
This PR will close #353
Checklist