apache / apache/dubbo

[Bug] Triple protocol reExport failed when overriding provider's url

Open
#14,430 2 comments 0 reactions 0 assignees View on GitHub
component/need-triage type/need-triage
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

### Pre-check

- [X] I am sure that all the content I provide is in English.

### Search before asking

- [X] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues.

### Apache Dubbo Component

Java SDK (apache/dubbo)

### Dubbo Version

3.2.14

### Steps to reproduce this issue

step 1. add dynamic configuration like this

```
configVersion: v2.7
configs:
- addresses:
- xxxx:xxxx
parameters:
disabled: true
side: provider
enabled: true
key: xxxx
scope: application
```

step 2. Provider throws an IllegalStateException in TripleProtocol#export because serviceKey contains version while interfaceName does not.
![image](https://github.com/user-attachments/assets/bf991090-8e22-4c91-afd3-e6e74440dc6f)

### What you expected to happen

Why compare serviceKey with interfaceName here? Why not compare serviceKey with provious's serviceKey?

### Anything else
```
2024-07-15 09:51:00,528 [ZookeeperDynamicConfiguration-thread-1] ERROR NodeCache: - Calling listener
java.lang.IllegalStateException: Already exists an invoker[\*\*\*\*\*\*\*\*] on path[\*\*\*\*\*\*\*\*], failed to add invoker[\*\*\*\*\*\*\*\*] , please use unique serviceKey.
at org.apache.dubbo.rpc.protocol.tri.TripleProtocol.export(TripleProtocol.java:126) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.qos.protocol.QosProtocolWrapper.export(QosProtocolWrapper.java:79) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.rpc.protocol.ProtocolSecurityWrapper.export(ProtocolSecurityWrapper.java:84) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.rpc.protocol.ProtocolListenerWrapper.export(ProtocolListenerWrapper.java:77) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.rpc.cluster.filter.ProtocolFilterWrapper.export(ProtocolFilterWrapper.java:61) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.rpc.protocol.ProtocolSerializationWrapper.export(ProtocolSerializationWrapper.java:50) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.rpc.protocol.InvokerCountWrapper.export(InvokerCountWrapper.java:42) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.rpc.Protocol$Adaptive.export(Protocol$Adaptive.java) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.registry.integration.RegistryProtocol.reExport(RegistryProtocol.java:381) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.registry.integration.RegistryProtocol$OverrideListener.doOverrideIfNecessary(RegistryProtocol.java:874) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.registry.integration.RegistryProtocol$ProviderConfigurationListener.lambda$notifyOverrides$0(RegistryProtocol.java:982) ~[dubbo-3.2.14.jar:3.2.14]
at java.util.concurrent.ConcurrentHashMap$ValuesView.forEach(ConcurrentHashMap.java:4707) ~[?:1.8.0_302]
at org.apache.dubbo.registry.integration.RegistryProtocol$ProviderConfigurationListener.notifyOverrides(RegistryProtocol.java:980) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.registry.integration.AbstractConfiguratorListener.process(AbstractConfiguratorListener.java:104) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.configcenter.support.zookeeper.ZookeeperDataListener.lambda$dataChanged$0(ZookeeperDataListener.java:80) ~[dubbo-3.2.14.jar:3.2.14]
at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:895) ~[?:1.8.0_302]
at java.util.concurrent.CopyOnWriteArraySet.forEach(CopyOnWriteArraySet.java:404) ~[?:1.8.0_302]
at org.apache.dubbo.configcenter.support.zookeeper.ZookeeperDataListener.dataChanged(ZookeeperDataListener.java:80) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.dubbo.remoting.zookeeper.curator5.Curator5ZookeeperClient$NodeCacheListenerImpl.nodeChanged(Curator5ZookeeperClient.java:442) ~[dubbo-3.2.14.jar:3.2.14]
at org.apache.curator.framework.recipes.cache.NodeCache.lambda$setNewData$0(NodeCache.java:323) ~[curator-recipes-5.3.0.jar:5.3.0]
at org.apache.curator.framework.listen.MappingListenerManager.lambda$forEach$0(MappingListenerManager.java:92) ~[curator-framework-5.3.0.jar:5.3.0]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_302]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_302]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_302]
```
### Are you willing to submit a pull request to fix on your own?

- [ ] Yes I am willing to submit a pull request on my own!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)

Contributor guide

Open the contributing guide

Research direction

Read TripleProtocol#export and RegistryProtocol.reExport, then trace how the provider serviceKey and interfaceName are produced during dynamic re-export. Reproduce the supplied v2.7 provider configuration and verify that overriding the provider URL no longer raises the duplicate-invoker IllegalStateException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.