Repository navigation
Add actor reentrancy support for HTTP and gRPC hosts - #1867
2748109647 wants to merge 4 commits into
Conversation
Signed-off-by: Alpha <2748109647@qq.com>
|
@2748109647 thanks for the PR. I don't want to ship reentrancy half done, and right now the sync path doesn't work. An actor method that calls another actor with Could you cover the sync path in this PR as well? One option is to also keep the id in a ThreadLocal around the method invocation. It needs a sync A -> B -> A test next to the async one. |
Synchronous actor methods can call another actor through a proxy that blocks on its own subscription. Reactor context is not propagated through that path, so the reentrancy id must be scoped around the actor method invocation and made available to the outgoing Dapr client call. Add a ThreadLocal fallback with nested-scope restoration and cover sync A -> B -> A calls for both HTTP and gRPC actor hosts. Signed-off-by: Alpha <2748109647@qq.com>
Signed-off-by: Alpha <2748109647@qq.com>
Signed-off-by: Alpha <2748109647@qq.com>
|
Thanks for the suggestion. I added synchronous The nested call can re-enter the same actor instance while its outer invocation is still active. I changed the actor lifecycle guard from a boolean to an active-call counter, preserve the outer invocation's cached state during nested calls, and decrement the counter on completion (including error/cancel paths). The existing scoped ThreadLocal reentrancy ID is exercised by the synchronous tests. While running the end-to-end test, I also found that the test interface's Validation:
On Windows I temporarily adjusted the existing local |
Summary
enabledand optionalmaxStackDepth) to HTTP actor discovery and gRPC registration.Dapr-Reentrancy-Idthrough Reactor context for asynchronous calls, and use a scopedThreadLocalwhile invoking synchronous actor methods so nested.block()calls retain the reentrancy ID. The previous value is restored when the invocation scope exits.Validation
mvn -B -pl sdk-actors testpassed: 233 tests, 0 failures or errors.mvn -B -pl sdk-actors -am checkstyle:checkpassed with 0 violations.sdk-testsintegration test sources, includingActorReentrancyIT.ActorReentrancyITwas not run locally because Docker is unavailable in this environment.Fixes #1838