xiaobaicai66695 opened a new pull request, #16546: URL: https://github.com/apache/dubbo/pull/16546
## What is the purpose of the change? Fixes #16545. `AppStateRouterFactory` returned one mutable `AppStateRouter` for every service reference in the same module. Building a second service's `SingleRouterChain` calls `setNextRouter` on that shared object, which changes the first chain's successor. In the linked reproduction, the Order service's application script rule is loaded but its script router is skipped after the User reference is initialized. This change uses the existing `CacheableStateRouterFactory` to cache `AppStateRouter` instances by service key, consistent with the other service and application script router factories. It adds a regression test that builds two service chains in either order and checks that the first chain still filters its invokers after the second chain is built. ## Verification - Before the fix, both regression cases failed: the first chain returned two invokers where only one was allowed. - After the fix, `AppStateRouterFactoryTest` passed: **2 tests, 0 failures, 0 errors**. - `./mvnw -pl dubbo-cluster -am validate` passed, including the configured formatting checks. - Real RPC reproduction from #16545: ZooKeeper registry, Nacos 2.5.2 configuration center, two Order provider JVMs and one User provider JVM, JDK 8. With the JDK 8 compatible `AppStateRouterFactory` compiled from this branch loaded ahead of the Dubbo 3.3.6 runtime, **five fresh consumer JVMs each sent 20 Order RPCs and all 20 reached order-v2**. The unmodified 3.3.6 control leaked Order calls to order-v1 in all five runs. The complete demo source and rule are in #16545. ## Checklist - [x] Linked the reproducing issue. - [x] Added regression coverage for both service-chain construction orders. - [x] Ran the focused test and local real-RPC reproduction. - [ ] GitHub Actions results pending. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
