Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Data sync dataId for proxy selector and discovery is not unique #5782

Open
1 task done
Wweiei opened this issue Nov 13, 2024 · 0 comments
Open
1 task done

[BUG] Data sync dataId for proxy selector and discovery is not unique #5782

Wweiei opened this issue Nov 13, 2024 · 0 comments
Labels
type: bug Something isn't working

Comments

@Wweiei
Copy link
Contributor

Wweiei commented Nov 13, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

  1. In divide plugin. If push sync data to nacos or zookeeper, the dataId for proxy selector and discovery is not unique, because the suffix dataId for proxy selector and discovery is is the name of the selector and not the id. if there are two selector and they have the same name, the config will be covered.
  • use nacos as sync center.
  • there are two selector and they have the same name.one selector's upstream is 172.16.22.22:17203, the other is 172.16.22.22:17204.
    image
    image
    image
    image
  • There is only one piece of configuration data on nacos。
    image
    image
  • the discovery config for two selector should have two config with different dataId, but only one.
    image
    image
  1. If the selector has a special character like '/test', push sync data to nacos will fail due to nacos dataId format validation.
    image
    image

Expected Behavior

I think the value for {namespaceId}.proxy.selector.divide.list and {namespaceId}..discovery.divide.list is selector's id wiil be better。And the detail config dataId's suffix for selector is selectorid too.

Steps To Reproduce

  1. check out to master branch and pull the lastest code.
  2. use nacos as data sync center.
  3. add two divide selector with same name like 'test'.
  4. change one of the selector's name with a special character '/test'.

Environment

ShenYu version(s): branch master latest

Debug logs

com.alibaba.nacos.api.exception.NacosException: dataId invalid
	at com.alibaba.nacos.client.config.utils.ParamUtils.checkKeyParam(ParamUtils.java:102)
	at com.alibaba.nacos.client.config.utils.ParamUtils.checkParam(ParamUtils.java:159)
	at com.alibaba.nacos.client.config.NacosConfigService.publishConfigInner(NacosConfigService.java:226)
	at com.alibaba.nacos.client.config.NacosConfigService.publishConfig(NacosConfigService.java:131)
	at org.apache.shenyu.admin.listener.nacos.NacosDataChangedListener.doPublishConfig(NacosDataChangedListener.java:49)
	at org.apache.shenyu.admin.listener.AbstractNodeDataChangedListener.publishConfig(AbstractNodeDataChangedListener.java:294)
	at org.apache.shenyu.admin.listener.AbstractNodeDataChangedListener.lambda$onCommonMultiChanged$13(AbstractNodeDataChangedListener.java:230)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.apache.shenyu.admin.listener.AbstractNodeDataChangedListener.onCommonMultiChanged(AbstractNodeDataChangedListener.java:230)
	at org.apache.shenyu.admin.listener.AbstractNodeDataChangedListener.onDiscoveryUpstreamChanged(AbstractNodeDataChangedListener.java:288)
	at org.apache.shenyu.admin.listener.DataChangedEventDispatcher.onApplicationEvent(DataChangedEventDispatcher.java:102)
	at org.apache.shenyu.admin.listener.DataChangedEventDispatcher.onApplicationEvent(DataChangedEventDispatcher.java:50)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:451)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:384)
	at org.apache.shenyu.admin.service.impl.UpstreamCheckService.updateSelectorHandler(UpstreamCheckService.java:435)
	at org.apache.shenyu.admin.service.impl.UpstreamCheckService.updateHandler(UpstreamCheckService.java:372)
	at org.apache.shenyu.admin.service.impl.UpstreamCheckService.lambda$check$8(UpstreamCheckService.java:360)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1804)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
	at java.base/java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
2024-11-13 14:53:16 [ForkJoinPool.commonPool-worker-15] ERROR org.apache.shenyu.admin.listener.AbstractNodeDataChangedListener - AbstractNodeDataChangedListener onCommonMultiChanged error 
org.apache.shenyu.common.exception.ShenyuException: dataId invalid
	at org.apache.shenyu.admin.listener.nacos.NacosDataChangedListener.doPublishConfig(NacosDataChangedListener.java:56)
	at org.apache.shenyu.admin.listener.AbstractNodeDataChangedListener.publishConfig(AbstractNodeDataChangedListener.java:294)
	at org.apache.shenyu.admin.listener.AbstractNodeDataChangedListener.lambda$onCommonMultiChanged$13(AbstractNodeDataChangedListener.java:230)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.apache.shenyu.admin.listener.AbstractNodeDataChangedListener.onCommonMultiChanged(AbstractNodeDataChangedListener.java:230)
	at org.apache.shenyu.admin.listener.AbstractNodeDataChangedListener.onDiscoveryUpstreamChanged(AbstractNodeDataChangedListener.java:288)
	at org.apache.shenyu.admin.listener.DataChangedEventDispatcher.onApplicationEvent(DataChangedEventDispatcher.java:102)
	at org.apache.shenyu.admin.listener.DataChangedEventDispatcher.onApplicationEvent(DataChangedEventDispatcher.java:50)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:185)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:178)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:156)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:451)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:384)
	at org.apache.shenyu.admin.service.impl.UpstreamCheckService.updateSelectorHandler(UpstreamCheckService.java:435)
	at org.apache.shenyu.admin.service.impl.UpstreamCheckService.updateHandler(UpstreamCheckService.java:372)
	at org.apache.shenyu.admin.service.impl.UpstreamCheckService.lambda$check$8(UpstreamCheckService.java:360)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run$$$capture(CompletableFuture.java:1804)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.exec(CompletableFuture.java:1796)
	at java.base/java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:373)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)```

### Anything else?

_No response_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant