[Bug]: Nacos script rule deletion leaves routing active with no listener event after #3725
What happened?
Deleting a Nacos script-routing DataID does not deactivate the rule for an already running dubbo-go consumer in this setup. Nacos confirms that the DataID is absent, but subsequent RPCs continue to select only the instance specified by the deleted script.
Expected: after deleting go-route-probe-order.script-router, the same consumer can route Order calls to either registered Order provider. Its config listener receives a deletion event, or another signal that clears the local rule.
Actual: after the deletion is visible through Nacos GetRule / HTTP 404 and 45 seconds have elapsed, 12/12 Order calls still go to order-v2. An independent ConfigurationListener on the same DataID observes zero delete events and zero empty-content updates during that period. Republishing the YAML does deliver an update event, so the listener is registered. No RPC fails: this is stale routing, not the empty-invoker / No provider available failure seen in Dubbo Java.
This is reproducible on the latest released v3.3.2. I also built the same demo against commit be501fd96d5f459aa2d2850c370bb448896e19da from merged #3725, which maps received empty callbacks to EventTypeDel. The result is unchanged because no deletion callback reached the observer in this environment. This report is about that remaining end-to-end behavior, rather than the callback-type mapping already addressed by #3725.
How can we reproduce it?
-
Start Nacos 2.5.2 in standalone mode. Use Nacos for both service registry and config center (
group: dubbo). -
Start three independent dubbo-go Dubbo-protocol providers:
order-v1, port24481, applicationgo-route-probe-order, interfaceexample.com.routeprobe.OrderServiceorder-v2, port24482, same application and interfaceuser, port24483, applicationgo-route-probe-user, interfaceexample.com.routeprobe.UserServiceEach service implementsPing(string) (string, error)and returns its instance name.
-
Publish this Nacos rule under DataID
go-route-probe-order.script-router, groupdubbo:configVersion: v3.0 enabled: true key: go-route-probe-order scope: application type: javascript script: | (function route(invokers, invocation, context) { var result = []; for (var i = 0; i < invokers.length; i++) { if (invokers[i].GetURL().Port == "24482") { result.push(invokers[i]); } } return result; })(invokers, invocation, context); -
In one consumer process, initialize the Nacos registry and config center, create references to both Order and User (tested in both creation orders), and add an independent
ConfigurationListenertogo-route-probe-order.script-router. Confirm User RPC succeeds and 8/8 Order RPCs reachorder-v2. -
Call
dynamicConfiguration.RemoveConfig("go-route-probe-order.script-router", "dubbo"). PollGetRuleuntil the rule is absent; the Nacos HTTP API also returns 404. Keep the same consumer process alive for 45 seconds, then make 12 more Order RPCs. -
Republish the original YAML and make 8 more Order RPCs. The observer receives an
updateon republish. Restore the initial DataID state after the run.
Observed output with v3.3.2 (order-first with a 45-second wait; both reference orders also reproduced with a 15-second wait):
NACOS_RULE_AFTER_DELETE=absent
CONFIG_EVENTS_AFTER_DELETE deletes=0 empty_updates=0
RESULT before={order-v2:8} deleted={order-v2:12} restored={order-v2:8}
Observed output with the #3725 head (be501fd, one order-first run, 45-second wait):
NACOS_RULE_AFTER_DELETE=absent
CONFIG_EVENTS_AFTER_DELETE deletes=0 empty_updates=0
CONFIG_EVENT key=go-route-probe-order.script-router type=update is_delete=false content_len=380 # after republish
RESULT before={order-v2:8} deleted={order-v2:12} restored={order-v2:8}
The application-level Order and User references remain isolated in both creation orders. The failing assertion here is only the dynamic deletion. The original DataID did not exist before the demo and was absent again afterward; provider processes were stopped.
Environment
- dubbo-go
v3.3.2(go version -mconfirmed), plus a separate build from merged PR #3725 headbe501fd - Go
1.25.5, Windows/amd64 - Nacos server
2.5.2, standalone, authentication disabled github.com/nacos-group/nacos-sdk-go/v2 v2.2.5in the #3725-head build- Dubbo protocol, two Order instances and one User instance, application-level Nacos service discovery
Notes for investigation
In v3.3.2, the Nacos config callback labels all received callbacks as EventTypeUpdate; the script router clears state only on EventTypeDel. PR #3725 changes the former mapping for empty callback content. The independent listener in this reproduction receives the subsequent republish update but no callback at all during deletion, so the test does not establish whether an empty callback would be handled correctly here. It suggests checking the Nacos SDK delete-notification path and subscription lifecycle in a real Nacos 2.5.2 environment, in addition to unit-testing the callback mapper.