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

Zookeeper need catch exception when write failed #12941

Open
schneiderlin opened this issue Aug 22, 2023 · 11 comments
Open

Zookeeper need catch exception when write failed #12941

schneiderlin opened this issue Aug 22, 2023 · 11 comments
Labels
component/sdk Related with apache/dubbo good first issue Good for starters to contribute help wanted Everything needs help from contributors type/bug Bugs to being fixed
Milestone

Comments

@schneiderlin
Copy link
Contributor

假设 zk 上的 dubbo 注册信息根路径是 /dubbo.
上面有接口级的例如

/dubbo/com.example.SomeInterface

还有应用级的, 例如

/dubbo/SomeService
   - 127.0.0.1:20880

当 org.apache.dubbo.registry.zookeeper.ZookeeperRegistry#doSubscribe 调用的时候, 如果走到了 ANY_VALUE.equals(url.getServiceInterface()) 的分支, 会把底下所有子节点都 subscribe.

即上面例子的 /dubbo/com.example.SomeInterface 和 /dubbo/SomeService 都 subscribe 了.
这两个子节点会触发

for (String path : toCategoriesPath(url)) {
  ...
  zkClient.create(path, false);
  ...
}

于是应用级的接口就会变成这样

/dubbo/SomeService
   - 127.0.0.1:20880
   - configurators
   - consumers
   - providers
   - routers

应用级节点里面的每个子节点(例子中的127.0.0.1:20880)的内容应该是可以序列化到 ServiceInstance 的 json.
但是 configurators, consumers, providers, routers 这几个自动创建的不是 json. 导致解析错误

@schneiderlin schneiderlin added the type/bug Bugs to being fixed label Aug 22, 2023
@AlbumenJ
Copy link
Member

应用级的注册根路径为 /services

@schneiderlin
Copy link
Contributor Author

应用级的注册根路径为 /services

什么意思, 是用户使用的时候保证应用级注册到 /services 吗? 还是说 dubbo 在写应用级节点的时候自己处理的

@AlbumenJ
Copy link
Member

image
image

@schneiderlin
Copy link
Contributor Author

我认为不管根目录是什么都会触发这个 bug.

我注册时指定了 group, 所以会用 group 作为根目录.
dubbo admin 启动的时候会去根目录的每个子节点写 configurators, consumers, providers, routers.

把根目录从 group 变成默认的 /services 也是一样的

@AlbumenJ
Copy link
Member

  1. 接口级和应用级的写入路径都已经跑了很多年了,所以修改写入的格式目前来看不太现实
  2. 这个问题仅在配置了注册中心的 group 以后会发生
  3. ANY_VALUE 这个写入进发生在 dubbo-admin 中,正常的请求逻辑不会有这种订阅

综上,最好的解决方案是 dubbo-admin 侧在订阅的时候修改实现的模式

@schneiderlin
Copy link
Contributor Author

或者考虑在解析节点的时候 catch 错误呢? 解析不了的就打个 warning 然后 ignore

@AlbumenJ
Copy link
Member

或者考虑在解析节点的时候 catch 错误呢? 解析不了的就打个 warning 然后 ignore

catch 是需要的,你可以提个 PR 修复下吗

@schneiderlin
Copy link
Contributor Author

好的, assign 给我吧

@CrazyHZM
Copy link
Member

@schneiderlin
Is there any progress?

@CrazyHZM CrazyHZM added this to the 3.2.11 milestone Dec 28, 2023
@CrazyHZM CrazyHZM modified the milestones: 3.2.11, 3.2.12 Jan 27, 2024
@AlbumenJ AlbumenJ added help wanted Everything needs help from contributors component/sdk Related with apache/dubbo good first issue Good for starters to contribute labels Mar 11, 2024
@AlbumenJ AlbumenJ changed the title dubbo 启动时往 zookeeper 写了错误节点, 导致解析节点内容出错 Zookeeper need catch exception when write failed Mar 11, 2024
@walkinggo
Copy link
Contributor

is there done?i want to try it if nobody want do it.

@CrazyHZM
Copy link
Member

CrazyHZM commented May 1, 2024

@walkinggo Go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/sdk Related with apache/dubbo good first issue Good for starters to contribute help wanted Everything needs help from contributors type/bug Bugs to being fixed
Projects
Status: No status
Development

No branches or pull requests

4 participants