<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.3</li>
<li>Operating System version: xxx</li>
<li>Java version: 1.8</li>
<li>Springboot: 2.1.8</li>
<li>nacos: 1.1.3</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>在<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/reference/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/reference">@reference</a>配置指定方法的超时时间2000,其他地方的超时配置全去掉</li>
<li>测试</li>
<li>dubbo使用了超时时间1000,即<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/reference/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/reference">@reference</a>的配置不生效</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<ol dir="auto">
<li>关于超时时间的优先级,我的理解是<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/reference/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/reference">@reference</a>&gt;<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a>&gt;consumer的yml配置&gt;provider的yml配置</li>
<li>在provider和consumer的bootstrap.yml里使用dubbo.consumer.timeout和dubbo.provider.timeout配置各自的全局超时时间</li>
<li>在<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/reference/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/reference">@reference</a>和<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a>注解上配置指定方法或指定类的超时时间</li>
<li>期望通过以上方式合理的控制超时时间</li>
</ol>
<h3 dir="auto">Actual Result</h3>
<ol dir="auto">
<li>springboot+dubbo+nacos项目能够正常运行</li>
<li>只在consumer的yml里使用dubbo.consumer.timeout配置超时时间,生效,符合预期</li>
<li>注释掉2的配置,系统使用了dubbo的默认超时时间1000,符合预期</li>
<li>只在 consumer使用<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/reference/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/reference">@reference</a>(version = "${this.version}", timeout = 6000) 不符合预期 ,期望使用6000,测试结果显示使用了默认的1000</li>
<li>只在consumer使用<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/reference/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/reference">@reference</a>(version = "${this.version}"  ,methods = {<br>
<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/method/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/method">@method</a>(name = "xxxMethod", timeout = 5000)<br>
})  不符合预期 期望使用配置的,测试结果显示使用了默认的1000</li>
<li>只在provider配置<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a>(version = "${this.version}", methods = {<br>
<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/method/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/method">@method</a>(name = "xxxMethod", timeout = 21000)<br>
}) 不符合预期 期望使用配置的,测试结果显示使用了默认的1000</li>
<li>只在<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a>(version = "${this.version}", timeout = 4000)配置超时时间, 符合预期</li>
<li>在provider的yml里配置dubbo.provider.timeout=5000,并在<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a>(version = "${this.version}", timeout = 4000),  不符合预期,测试结果是5000,期望是service上的能覆盖全局的</li>
</ol>
<p dir="auto">总结:</p>
<ol dir="auto">
<li>请问是我优先级理解错误,还是<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/reference/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/reference">@reference</a>和<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/service/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/service">@service</a>注解配置不生效</li>
<li>如何实现在一个地方可以配置整体的超时时间,又可以在特定的接口或者方法上配置特殊的超时时间</li>
</ol>
<p dir="auto">注:<br>
1.用的是org.apache.dubbo.config.annotation.Reference和org.apache.dubbo.config.annotation.Service<br>
2. consumer是一个springboot项目 , provider是另一个springboot项目,服务的注册发现,提供给别的项目使用,都没有问题.</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have searched the <a href="https://github.com/apache/incubator-dubbo/issues">issues</a> of this repository and believe that this is not a duplicate.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have checked the <a href="https://github.com/apache/incubator-dubbo/blob/master/FAQ.md">FAQ</a> of this repository and believe that this is not a duplicate.</li>
</ul>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.6.2</li>
<li>Operating System version: CentOS x64</li>
<li>Java version: 1.8</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>使用dubbo 2.6.2，搭建dubbo服务（技术栈：dubbo，spring boot 2.0.4.RELEASE，zookeeper）</li>
<li>暴露dubbo任意dubbo服务，此服务的逻辑中调用别的服务</li>
<li>运行一段时间后，发现控制台界面出现以下警告：<br>
<code class="notranslate">WARN  com.alibaba.dubbo.registry.integration.RegistryDirectory:200 notify [DUBBO] Unsupported category providers,configurators,routers in notified url: empty://。。。</code></li>
</ol>
<p dir="auto">从日志中查看到，警告为RegistryDirectory类第 200行打印出的警告，如下图：<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/43158596/58146768-246d8880-7c8a-11e9-8946-2e7fb61ebab6.jpg"><img src="https://user-images.githubusercontent.com/43158596/58146768-246d8880-7c8a-11e9-8946-2e7fb61ebab6.jpg" alt="01" style="max-width: 100%;"></a><br>
通过断点，进一步追综代码运行堆栈，发现，问题可能在于  CuratorWatcherImpl （CuratorZookeeperClient类的一个内部类），process方法中，path为null引起，如下图：<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/43158596/58146992-1f5d0900-7c8b-11e9-9e84-6fbaea8f1566.jpg"><img src="https://user-images.githubusercontent.com/43158596/58146992-1f5d0900-7c8b-11e9-9e84-6fbaea8f1566.jpg" alt="02" style="max-width: 100%;"></a><br>
因为当以上170行代码的 path为null 的时候，会被赋予一个空字符串""，这导致 171行代码调用childChanged时，传了空串参数进去。（请注意上图中第172处的  // if path is null, curator using watcher will throw NullPointerException. 之类的注释，可能有助于解决这个问题）<br>
因为为path赋值了空串参数，导致 ZookeeperRegistry类中的 179行代码进调用 notify 的时候，传了空字符串参数进去，如下图：<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/43158596/58147289-6992ba00-7c8c-11e9-9005-c2a63c50db43.jpg"><img src="https://user-images.githubusercontent.com/43158596/58147289-6992ba00-7c8c-11e9-9005-c2a63c50db43.jpg" alt="03" style="max-width: 100%;"></a><br>
（说明：以上代码块为 ZookeeperRegistry 中的 doSubscribe 方法，用于消费者订阅 ，该方法内部开启了一个监听节点变化的 listener），因为进传递进来的 parentPath 参数为空串，导致 179行代码在调用 toUrlsWithEmpty 方法的时候，得到的 url 中的 category 的值依旧为providers,configurators,routers ，重而导致上诉警告。<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/43158596/58147670-3b15de80-7c8e-11e9-8602-b4b8184b914b.jpg"><img src="https://user-images.githubusercontent.com/43158596/58147670-3b15de80-7c8e-11e9-8602-b4b8184b914b.jpg" alt="09" style="max-width: 100%;"></a></p>
<p dir="auto">通过以上分析，问题原因，很可能就是 RegistryDirectory类第 170行处path为null引起，通过那段代码块的注释，我猜测，可能 是为了解决 空指针异常而产生的新的警告，相关issue如下：<br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="274455224" data-permission-text="Title is private" data-url="https://github.com/apache/dubbo/issues/870" data-hovercard-type="issue" data-hovercard-url="/apache/dubbo/issues/870/hovercard" href="https://github.com/apache/dubbo/issues/870">#870</a><br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="276755467" data-permission-text="Title is private" data-url="https://github.com/apache/dubbo/issues/928" data-hovercard-type="pull_request" data-hovercard-url="/apache/dubbo/pull/928/hovercard" href="https://github.com/apache/dubbo/pull/928">#928</a></p>