xiaobaicai66695 opened a new pull request, #16549: URL: https://github.com/apache/dubbo/pull/16549
## What does this PR do? Fixes #16548. - Store the script rule and compiled script router in one immutable state and publish it through a single volatile reference. - Clear that state when a configuration `DELETED` event arrives, so routing passes through to the healthy provider candidates. - Add a regression test for rule addition, deletion, and republishing. ## Why? In 3.3.6, `AppScriptStateRouter.process(DELETED)` clears `scriptRule` but leaves `scriptRouter` non-null. The next invocation passes the null-router guard and dereferences `scriptRule.isValid()`. `DynamicDirectory` catches the exception and returns an empty invoker list, causing `No provider available` even when providers are healthy. Publishing the rule and compiled router together also prevents an invocation from observing values from different configuration revisions. This bug reproduces with a single service reference on unmodified 3.3.6. It is independent of the cross-service chain issue in [#16545](https://github.com/apache/dubbo/issues/16545) and [#16546](https://github.com/apache/dubbo/pull/16546). ## How was this tested? - The new `AppScriptStateRouterTest` case fails with a `NullPointerException` at `doRoute` on unmodified 3.3 source, then passes with this change. - `./mvnw -pl dubbo-cluster -Dtest=AppScriptStateRouterTest -Dsurefire.failIfNoSpecifiedTests=false test`: 2 tests, 0 failures, 0 errors. - Local real-RPC E2E with Nacos 2.5.2, an embedded ZooKeeper registry, two Order provider JVMs, and one consumer JVM: - With the original 3.3.6 router factory and one reference: before deletion v2=5; after Nacos returned 404, v1=2/v2=3; after republishing v2=5. - With the separate per-service router-factory fix and two references: the same sequence and counts. - No router NPE or provider-unavailable error after deletion. No production cluster changes are included in this PR. -- 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]
