Skip to content

[BUG] Apollo incremental change events silently dropped (bare data-ID prefixes vs namespace-prefixed keys) #6838

Description

@Aias00

Description

ApolloDataService registers configService.addChangeListener(listener, emptySet, ApolloPathConstants.pathKeySet()) passing bare data IDs ("plugin", "selector", "rule", "auth", "meta", "proxy.selector", "discovery") as interestedKeyPrefixes. Apollo's AbstractConfig.isConfigChangeListenerInterested checks changedKey.startsWith(prefix). Actual property keys are namespace-prefixed (namespaceId + "." + dataId + "." + ..., e.g. 649330b6-….plugin.pluginName) per AbstractNodeDataSyncService:86-96, so startsWith("plugin") is false — the listener is never notified for incremental changes. Even if notified, the handler body checks changeKey.indexOf(PLUGIN_DATA_ID) == 0, which also fails for namespaced keys. Startup loading via getProperty still works; only incremental changes are dropped. The unit tests bypass Apollo's filtering by invoking the captured listener directly with unrealistic keys.

Location

  • shenyu-sync-data-center/shenyu-sync-data-apollo/src/main/java/org/apache/shenyu/sync/data/apollo/ApolloDataService.java:102-144 (handler), :150 (registration)
  • shenyu-common/src/main/java/org/apache/shenyu/common/constant/ApolloPathConstants.java:37-67
  • shenyu-sync-data-center/shenyu-sync-data-api/src/main/java/org/apache/shenyu/sync/data/core/AbstractNodeDataSyncService.java:86-96 (namespaced keys)

Impact

After initial startup load, ALL incremental Apollo change events (plugin/selector/rule/meta/auth/proxy/discovery) are silently dropped. The gateway never receives any config change until full restart. Apollo sync is effectively static-only. Security-relevant changes (auth/plugin disable) won't apply until restart.

Suggested fix

Register prefixes that include the namespace prefix (e.g. namespaceId + "." + PLUGIN_DATA_ID), and change the handler indexOf==0 checks to changeKey.startsWith(namespaceId + "." + PLUGIN_DATA_ID); add an integration test that flows through Apollo's real filtering.

Related existing

None — filed Apollo items concern long-polling/websocket, not Apollo prefix matching.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions