Skip to content

Support actor reentrancy (HTTP and gRPC actor host) #1838

Open

Description

@javier-aliaga

Follow-up to #1761.

The gRPC actor host added for #1761 (ActorRuntime.subscribeActorEvents()) does not support actor reentrancy, because the Java SDK has no reentrancy support today, over HTTP or gRPC.

What is missing

  • Config: ActorRuntimeConfig and ActorTypeConfig have no reentrancy setting. The initial request of SubscribeActorEventsAlpha1 has a reentrancy field (ActorReentrancyConfig), and the gRPC host leaves it unset. Over HTTP, /dapr/config does not return an entitiesConfig.reentrancy block either.
  • Propagation: daprd sends Dapr-Reentrancy-Id in the metadata of invoke, reminder and timer requests. The SDK does not forward it on outgoing actor calls made from inside an actor method, so a call back into the same actor chain blocks instead of re-entering.

Proposal

  1. Add a reentrancy config (enabled, maxStackDepth) to ActorRuntimeConfig and ActorTypeConfig.
  2. Send it in the gRPC initial request and in the HTTP /dapr/config response.
  3. Carry the incoming Dapr-Reentrancy-Id through the actor call context, and attach it to actor invocations made by the actor while it handles that call.

Acceptance criteria

  • With reentrancy enabled, actor A → actor B → actor A completes instead of deadlocking, over both HTTP and the gRPC host.
  • Unit tests cover the config mapping. An integration test covers the reentrant call chain.

Activity

  1. 2748109647 commented on Oct 23, 2026

    @2748109647

    Hi @javier-aliaga, @cicoyle — I'd like to help with this and align on the context propagation design before implementing it.

    I traced DaprController and ActorEventDispatcher into ActorRuntime. Neither entry path currently carries the incoming reentrancy ID into actor execution. On the outbound side, actors' DaprClientImpl.invoke() already uses Mono.deferContextual, but builds InvokeActorRequest beforehand from client-level metadata. That looks like a useful place to resolve invocation-specific metadata at subscription time.

    My proposed approach:

    • Add global/per-actor-type reentrancy configuration and map it consistently to HTTP discovery JSON and the gRPC initial subscription request.
    • Capture Dapr-Reentrancy-Id at both host entry points, including reminder/timer callbacks, and propagate it through invocation-scoped Reactor context into outgoing actor requests without mutating shared client metadata.
    • Keep the default disabled behavior, with tests for HTTP/gRPC A → B → A, depth limits, and concurrent invocation isolation.

    I also read the discussion in #545: the concerns about shared ID state, nested call chains and expanding public APIs still seem relevant. I'd first validate propagation through nested actor calls and scheduler switches with focused tests, rather than assume Reactor context alone solves every invocation style.

    Is an internal Reactor-context approach the preferred direction, and are there existing compatibility expectations for blocking actor implementations that I should account for?

  2. added this to the v1.20 milestone on Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/enhancement

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions