<p dir="auto">Lots of "The same service provided by two applications!" on the provider page.<br>
This must be a displaying bug。<br>
see also: <a href="http://blog.csdn.net/u012063409/article/details/59110559" rel="nofollow">http://blog.csdn.net/u012063409/article/details/59110559</a></p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> 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" checked=""> I have checked the <a href="https://github.com/apache/incubator-dubbo/wiki/FAQ">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.5.10</li>
<li>Operating System version: MacOS Sierra 10.12</li>
<li>Java version: JDK 1.8</li>
</ul>
<h3 dir="auto">Step to reproduce this issue</h3>
<ol dir="auto">
<li>Start dubbo provider (retries=0).</li>
<li>Start dubbo consumer*10 in 5000 QPS (provider in 5w QPS).</li>
<li>Update dynamic config(override URL) for consumer, it will trigger RegistryDirectory notify(same as DubboAdmin 动态配置).</li>
</ol>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">The dynamic config(override url) takes effect after RegistryDirectory notify, without RpcException .</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">What is actually happen?<br>
Sometimes, client throws RpcException after dynamic config, because invoker been destroyed after refreshInvoker. This issue may happen in low QPS, 5W QPS happens in high rate(dubbo's default.retires=2 covers the issue).<br>
Note: We have set default.retries=0 in the concerns of idempotency, because consumer will retry always.</p>
<p dir="auto">The AbstractInvoker throws the RpcException as it been destroyed.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="public Result invoke(Invocation inv) throws RpcException {
        if (destroyed.get()) {
            throw new RpcException(&quot;Rpc invoker for service &quot; + this + &quot; on consumer &quot; + NetUtils.getLocalHost()
                    + &quot; use dubbo version &quot; + Version.getVersion()
                    + &quot; is DESTROYED, can not be invoked any more!&quot;);
        }
}"><pre class="notranslate"><span class="pl-k">public</span> <span class="pl-smi">Result</span> <span class="pl-s1">invoke</span>(<span class="pl-smi">Invocation</span> <span class="pl-s1">inv</span>) <span class="pl-k">throws</span> <span class="pl-s1">RpcException</span> {
        <span class="pl-k">if</span> (<span class="pl-s1">destroyed</span>.<span class="pl-en">get</span>()) {
            <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-smi">RpcException</span>(<span class="pl-s">"Rpc invoker for service "</span> + <span class="pl-smi">this</span> + <span class="pl-s">" on consumer "</span> + <span class="pl-smi">NetUtils</span>.<span class="pl-en">getLocalHost</span>()
                    + <span class="pl-s">" use dubbo version "</span> + <span class="pl-smi">Version</span>.<span class="pl-en">getVersion</span>()
                    + <span class="pl-s">" is DESTROYED, can not be invoked any more!"</span>);
        }
}</pre></div>
<p dir="auto">RegistryDirectory refreshInvoker destroyed the unused invoker, which caused the issue.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="private void refreshInvoker(List&lt;URL&gt; invokerUrls) {
        ....
        this.methodInvokerMap = multiGroup ? toMergeMethodInvokerMap(newMethodInvokerMap) : newMethodInvokerMap;
        this.urlInvokerMap = newUrlInvokerMap;
        try {
            destroyUnusedInvokers(oldUrlInvokerMap, newUrlInvokerMap); // Close the unused Invoker
        } catch (Exception e) {
            logger.warn(&quot;destroyUnusedInvokers error. &quot;, e);
        }
    }
}"><pre class="notranslate"><span class="pl-k">private</span> <span class="pl-smi">void</span> <span class="pl-s1">refreshInvoker</span>(<span class="pl-smi">List</span>&lt;<span class="pl-smi">URL</span>&gt; <span class="pl-s1">invokerUrls</span>) {
        ....
        <span class="pl-smi">this</span>.<span class="pl-s1">methodInvokerMap</span> = <span class="pl-s1">multiGroup</span> ? <span class="pl-en">toMergeMethodInvokerMap</span>(<span class="pl-s1">newMethodInvokerMap</span>) : <span class="pl-s1">newMethodInvokerMap</span>;
        <span class="pl-smi">this</span>.<span class="pl-s1">urlInvokerMap</span> = <span class="pl-s1">newUrlInvokerMap</span>;
        <span class="pl-k">try</span> {
            <span class="pl-en">destroyUnusedInvokers</span>(<span class="pl-s1">oldUrlInvokerMap</span>, <span class="pl-s1">newUrlInvokerMap</span>); <span class="pl-c">// Close the unused Invoker</span>
        } <span class="pl-k">catch</span> (<span class="pl-smi">Exception</span> <span class="pl-s1">e</span>) {
            <span class="pl-s1">logger</span>.<span class="pl-en">warn</span>(<span class="pl-s">"destroyUnusedInvokers error. "</span>, <span class="pl-s1">e</span>);
        }
    }
}</pre></div>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<p dir="auto">Just put your stack trace here!</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="com.alibaba.dubbo.rpc.RpcException: Rpc invoker for service interface com.ctrip.framework.benchmark.api.BenchmarkService -&gt; dubbo://10.5.89.100:20880/com.ctrip.framework.benchmark.api.BenchmarkService?anyhost=true&amp;application=100013636&amp;async=true&amp;check=false&amp;default.retries=0&amp;default.timeout=1005&amp;dubbo=2.0.1&amp;generic=false&amp;init=true&amp;interface=com.ctrip.framework.benchmark.api.BenchmarkService&amp;methods=echo&amp;pid=45&amp;qos.enable=false&amp;register.ip=10.5.88.92&amp;remote.timestamp=1529581187615&amp;revision=1.0.0&amp;serviceId=framework.soa.dubbobenchmarkservice.v1.dubbobenchmarkservice&amp;side=consumer&amp;timeout=5000&amp;timestamp=1529581726875 on consumer 10.5.88.92 use dubbo version 2.0.1 is DESTROYED, can not be invoked any more!
	at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:122)
	at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:73)
	at com.ctrip.framework.cdubbo.internal.filter.CatConsumerFilter.invokeAsync(CatConsumerFilter.java:60)
	at com.ctrip.framework.cdubbo.internal.filter.CatConsumerFilter.invoke(CatConsumerFilter.java:50)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:74)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:53)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:47)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.ctrip.framework.cdubbo.internal.delegate.client.CDubboInvoker.invokeAsync(CDubboInvoker.java:111)
	at com.ctrip.framework.cdubbo.internal.delegate.client.CDubboInvoker.invoke(CDubboInvoker.java:50)
	at com.ctrip.framework.cdubbo.internal.filter.CDubboInvokerFilter.invoke(CDubboInvokerFilter.java:31)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:52)
	at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:77)
	at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:232)
	at com.ctrip.framework.cdubbo.internal.delegate.client.CDubboClusterInvokerDelegate.invoke(CDubboClusterInvokerDelegate.java:40)
	at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:70)
	at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:51)
	at com.alibaba.dubbo.common.bytecode.proxy0.echo(proxy0.java)
	at com.ctrip.framework.benchmark.client.service.DubboBenchmarkServiceTester.test(DubboBenchmarkServiceTester.java:88)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)"><pre class="notranslate"><code class="notranslate">com.alibaba.dubbo.rpc.RpcException: Rpc invoker for service interface com.ctrip.framework.benchmark.api.BenchmarkService -&gt; dubbo://10.5.89.100:20880/com.ctrip.framework.benchmark.api.BenchmarkService?anyhost=true&amp;application=100013636&amp;async=true&amp;check=false&amp;default.retries=0&amp;default.timeout=1005&amp;dubbo=2.0.1&amp;generic=false&amp;init=true&amp;interface=com.ctrip.framework.benchmark.api.BenchmarkService&amp;methods=echo&amp;pid=45&amp;qos.enable=false&amp;register.ip=10.5.88.92&amp;remote.timestamp=1529581187615&amp;revision=1.0.0&amp;serviceId=framework.soa.dubbobenchmarkservice.v1.dubbobenchmarkservice&amp;side=consumer&amp;timeout=5000&amp;timestamp=1529581726875 on consumer 10.5.88.92 use dubbo version 2.0.1 is DESTROYED, can not be invoked any more!
	at com.alibaba.dubbo.rpc.protocol.AbstractInvoker.invoke(AbstractInvoker.java:122)
	at com.alibaba.dubbo.rpc.listener.ListenerInvokerWrapper.invoke(ListenerInvokerWrapper.java:73)
	at com.ctrip.framework.cdubbo.internal.filter.CatConsumerFilter.invokeAsync(CatConsumerFilter.java:60)
	at com.ctrip.framework.cdubbo.internal.filter.CatConsumerFilter.invoke(CatConsumerFilter.java:50)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.monitor.support.MonitorFilter.invoke(MonitorFilter.java:74)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.protocol.dubbo.filter.FutureFilter.invoke(FutureFilter.java:53)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:47)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.ctrip.framework.cdubbo.internal.delegate.client.CDubboInvoker.invokeAsync(CDubboInvoker.java:111)
	at com.ctrip.framework.cdubbo.internal.delegate.client.CDubboInvoker.invoke(CDubboInvoker.java:50)
	at com.ctrip.framework.cdubbo.internal.filter.CDubboInvokerFilter.invoke(CDubboInvokerFilter.java:31)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:68)
	at com.alibaba.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:52)
	at com.alibaba.dubbo.rpc.cluster.support.FailoverClusterInvoker.doInvoke(FailoverClusterInvoker.java:77)
	at com.alibaba.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:232)
	at com.ctrip.framework.cdubbo.internal.delegate.client.CDubboClusterInvokerDelegate.invoke(CDubboClusterInvokerDelegate.java:40)
	at com.alibaba.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:70)
	at com.alibaba.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:51)
	at com.alibaba.dubbo.common.bytecode.proxy0.echo(proxy0.java)
	at com.ctrip.framework.benchmark.client.service.DubboBenchmarkServiceTester.test(DubboBenchmarkServiceTester.java:88)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
</code></pre></div>