dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Bug] Registry check does not work in the case of multiple registrations and subscriptions at the application level, and provider export error causes Dubbo to fail to start

Open huangqy17 opened this issue 1 year ago • 11 comments

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 and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

dubbo3.2.16; jdk openjdk21

Steps to reproduce this issue

Dubbo3.2.16 uses two Nacos clusters as registration centers to implement application level multi subscription and multi subscription, and configure regirty.check=false. When one of the Nacos clusters is unavailable, dubbo serviceConfig. export reports an error causing startup failure, with the error message 'this.registry is null'

What you expected to happen

When a Nacos cluster is unavailable, it should be possible to export services normally on another Nacos cluster and ignore the other Nacos cluster

Anything else

No response

Are you willing to submit a pull request to fix on your own?

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

Code of Conduct

huangqy17 avatar Dec 16 '24 09:12 huangqy17

Can you show the complete error message?

walkinggo avatar Dec 27 '24 02:12 walkinggo

ServiceConfig#doExportUrl -> RegistryProtocol#export方法中,this.getRegistry(registryUrl)获得的Registry 是null,后面的逻辑没有判断这个值是否null,在RegistryProtocol#register方法中报空指针异常

huangqy17 avatar Dec 27 '24 05:12 huangqy17

其他场景也有类似的问题,有的场景会判断Registry是否为null,而正常结束; 有的就类似现在启动export时报空指针异常

huangqy17 avatar Dec 27 '24 05:12 huangqy17

我这个是多注册中心的高可用场景,如果多注册支持高可用的话,这里循环其中一个注册中心不应该异常退出

huangqy17 avatar Dec 27 '24 05:12 huangqy17

Uploading dubbo配置.jpg… 配置如图

huangqy17 avatar Dec 27 '24 07:12 huangqy17

dubbo配置

huangqy17 avatar Dec 27 '24 07:12 huangqy17

是的,我查看了这个问题,并确定它是存在的。我们应该提交一个合并请求来修复它。 @AlbumenJ

walkinggo avatar Dec 28 '24 09:12 walkinggo

大佬 有计划什么时候修复吗 @AlbumenJ @walkinggo

huangqy17 avatar Dec 30 '24 06:12 huangqy17

Add a configuration like checkThreshold in MultipleRegistry may works. Are there anyone want to contribute?

AlbumenJ avatar Jan 05 '25 08:01 AlbumenJ

大佬 帮看下我们的诉求是否和你们的设计初衷一样,我们的诉求是:在多注册中心下,如果全部注册中心或者部分注册中心可用,则export成功且启动成功,如果全部注册中心不可用,则异常结束让开发人员感知到

huangqy17 avatar Jan 07 '25 02:01 huangqy17

@huangqy17 If you don't want to receive the NPE, you can add this config: dubbo.registries.${id}.parameters=[{nacos.check:false}]

fantiq avatar Mar 17 '25 09:03 fantiq