warn Unsupported category providers,configurators,routers
- [ ] I have searched the issues of this repository and believe that this is not a duplicate.
- [ ] I have checked the FAQ of this repository and believe that this is not a duplicate.
Environment
- Dubbo version: 2.6.2
- Operating System version: CentOS x64
- Java version: 1.8
Steps to reproduce this issue
- 使用dubbo 2.6.2,搭建dubbo服务(技术栈:dubbo,spring boot 2.0.4.RELEASE,zookeeper)
- 暴露dubbo任意dubbo服务,此服务的逻辑中调用别的服务
- 运行一段时间后,发现控制台界面出现以下警告:
WARN com.alibaba.dubbo.registry.integration.RegistryDirectory:200 notify [DUBBO] Unsupported category providers,configurators,routers in notified url: empty://。。。
从日志中查看到,警告为RegistryDirectory类第 200行打印出的警告,如下图:
通过断点,进一步追综代码运行堆栈,发现,问题可能在于 CuratorWatcherImpl (CuratorZookeeperClient类的一个内部类),process方法中,path为null引起,如下图:
因为当以上170行代码的 path为null 的时候,会被赋予一个空字符串"",这导致 171行代码调用childChanged时,传了空串参数进去。(请注意上图中第172处的 // if path is null, curator using watcher will throw NullPointerException. 之类的注释,可能有助于解决这个问题)
因为为path赋值了空串参数,导致 ZookeeperRegistry类中的 179行代码进调用 notify 的时候,传了空字符串参数进去,如下图:
(说明:以上代码块为 ZookeeperRegistry 中的 doSubscribe 方法,用于消费者订阅 ,该方法内部开启了一个监听节点变化的 listener),因为进传递进来的 parentPath 参数为空串,导致 179行代码在调用 toUrlsWithEmpty 方法的时候,得到的 url 中的 category 的值依旧为providers,configurators,routers ,重而导致上诉警告。

通过以上分析,问题原因,很可能就是 RegistryDirectory类第 170行处path为null引起,通过那段代码块的注释,我猜测,可能 是为了解决 空指针异常而产生的新的警告,相关issue如下: https://github.com/apache/incubator-dubbo/issues/870 https://github.com/apache/incubator-dubbo/pull/928
if ptah is null. maybe the connect or disconnect event, I think it can be ignore and childListener.childChanged method should not be called
Try it with the latest version, if you still have problems, you can reopen the issues