<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" checked=""> 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.5</li>
<li>Operating System version: Mac OS 10.15.2</li>
<li>Java version: 1.8.0_231</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<ol dir="auto">
<li>通过brew安装etcd</li>
<li>执行etcd命令，前台模式启动etcd</li>
<li>启动provider服务（grpc + etcd）</li>
<li>执行 <code class="notranslate">etcdctl get / --prefix</code> 命令，观察到etcd中有数据</li>
<li>等mac经过1轮休眠，再执行 <code class="notranslate">etcdctl get / --prefix</code>，发现数据为空</li>
</ol>
<h3 dir="auto">Expected Result</h3>
<ul dir="auto">
<li>
<p dir="auto">注册信息不应该自己丢失</p>
</li>
<li>
<p dir="auto">即便注册信息丢失，也能在电脑唤醒后自己恢复</p>
</li>
</ul>
<h3 dir="auto">Actual Result</h3>
<ul dir="auto">
<li>
<p dir="auto">注册信息丢失</p>
</li>
<li>
<p dir="auto">dubbo输出以下日志</p>
</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2020-01-09 16:20:35.020  WARN 15182 --- [pool-6-thread-2] o.a.d.r.etcd.jetcd.JEtcdClientWrapper    :  [DUBBO] Failed to keep alive for global lease '7587843563781079999', waiting for retry again., dubbo version: 2.7.5, current host: ***"><pre class="notranslate"><code class="notranslate">2020-01-09 16:20:35.020  WARN 15182 --- [pool-6-thread-2] o.a.d.r.etcd.jetcd.JEtcdClientWrapper    :  [DUBBO] Failed to keep alive for global lease '7587843563781079999', waiting for retry again., dubbo version: 2.7.5, current host: ***
</code></pre></div>
<h3 dir="auto">相关代码和配置</h3>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import io.grpc.stub.StreamObserver;
import org.apache.dubbo.config.annotation.Service;
import org.apache.dubbo.rpc.RpcContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import testproto.DubboGreeterGrpc;
import testproto.HelloReply;
import testproto.HelloRequest;

import java.util.concurrent.*;

@Service(interfaceClass = DubboGreeterGrpc.IGreeter.class, version = &quot;1.0.0&quot;)
public class GreeterServiceImpl extends DubboGreeterGrpc.GreeterImplBase {

    @Override
    public void sayHello(HelloRequest request, StreamObserver&lt;HelloReply&gt; responseObserver) {
        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException ignored) {
        }
        responseObserver.onNext(HelloReply.newBuilder().setMessage(&quot;pong-java-&quot; + System.currentTimeMillis()).build());
        responseObserver.onCompleted();
    }

}"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">io</span>.<span class="pl-s1">grpc</span>.<span class="pl-s1">stub</span>.<span class="pl-s1">StreamObserver</span>;
<span class="pl-k">import</span> <span class="pl-s1">org</span>.<span class="pl-s1">apache</span>.<span class="pl-s1">dubbo</span>.<span class="pl-s1">config</span>.<span class="pl-s1">annotation</span>.<span class="pl-s1">Service</span>;
<span class="pl-k">import</span> <span class="pl-s1">org</span>.<span class="pl-s1">apache</span>.<span class="pl-s1">dubbo</span>.<span class="pl-s1">rpc</span>.<span class="pl-s1">RpcContext</span>;
<span class="pl-k">import</span> <span class="pl-s1">org</span>.<span class="pl-s1">slf4j</span>.<span class="pl-s1">Logger</span>;
<span class="pl-k">import</span> <span class="pl-s1">org</span>.<span class="pl-s1">slf4j</span>.<span class="pl-s1">LoggerFactory</span>;
<span class="pl-k">import</span> <span class="pl-s1">testproto</span>.<span class="pl-s1">DubboGreeterGrpc</span>;
<span class="pl-k">import</span> <span class="pl-s1">testproto</span>.<span class="pl-s1">HelloReply</span>;
<span class="pl-k">import</span> <span class="pl-s1">testproto</span>.<span class="pl-s1">HelloRequest</span>;

<span class="pl-k">import</span> <span class="pl-s1">java</span>.<span class="pl-s1">util</span>.<span class="pl-s1">concurrent</span>.*;

<span class="pl-c1">@</span><span class="pl-c1">Service</span>(<span class="pl-s1">interfaceClass</span> = <span class="pl-smi">DubboGreeterGrpc</span>.<span class="pl-smi">IGreeter</span>.<span class="pl-k">class</span>, <span class="pl-s1">version</span> = <span class="pl-s">"1.0.0"</span>)
<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">GreeterServiceImpl</span> <span class="pl-k">extends</span> <span class="pl-smi">DubboGreeterGrpc</span>.<span class="pl-smi">GreeterImplBase</span> {

    <span class="pl-c1">@</span><span class="pl-c1">Override</span>
    <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">sayHello</span>(<span class="pl-smi">HelloRequest</span> <span class="pl-s1">request</span>, <span class="pl-smi">StreamObserver</span>&lt;<span class="pl-smi">HelloReply</span>&gt; <span class="pl-s1">responseObserver</span>) {
        <span class="pl-k">try</span> {
            <span class="pl-smi">TimeUnit</span>.<span class="pl-c1">SECONDS</span>.<span class="pl-en">sleep</span>(<span class="pl-c1">1</span>);
        } <span class="pl-k">catch</span> (<span class="pl-smi">InterruptedException</span> <span class="pl-s1">ignored</span>) {
        }
        <span class="pl-s1">responseObserver</span>.<span class="pl-en">onNext</span>(<span class="pl-smi">HelloReply</span>.<span class="pl-en">newBuilder</span>().<span class="pl-en">setMessage</span>(<span class="pl-s">"pong-java-"</span> + <span class="pl-smi">System</span>.<span class="pl-en">currentTimeMillis</span>()).<span class="pl-en">build</span>());
        <span class="pl-s1">responseObserver</span>.<span class="pl-en">onCompleted</span>();
    }

}</pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="spring.application.name=dubbo-provider
server.port=8080
dubbo.application.name=${spring.application.name}
dubbo.application.metadata=remote
dubbo.protocol.name=grpc
dubbo.protocol.port=8888
dubbo.registry.address=etcd3://127.0.0.1:2379?registry-type=service
dubbo.provider.threads=10
dubbo.provider.threadpool=fixed
dubbo.provider.loadbalance=roundrobin
dubbo.metadata-report.address=etcd://127.0.0.1:2379"><pre class="notranslate"><code class="notranslate">spring.application.name=dubbo-provider
server.port=8080
dubbo.application.name=${spring.application.name}
dubbo.application.metadata=remote
dubbo.protocol.name=grpc
dubbo.protocol.port=8888
dubbo.registry.address=etcd3://127.0.0.1:2379?registry-type=service
dubbo.provider.threads=10
dubbo.provider.threadpool=fixed
dubbo.provider.loadbalance=roundrobin
dubbo.metadata-report.address=etcd://127.0.0.1:2379
</code></pre></div>
<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.4</li>
<li>Operating System version: win 10</li>
<li>Java version: jdk 8u22</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<p dir="auto">dubbo 2.7.4 版本dubbo-demo 运行报错,无法初始化配置器</p>
<ol dir="auto">
<li>
<p dir="auto">运行 dubbo-demo-api-provider,使用 zookeeper 3.5,已经确认zk 正常。<br>
service.setRegistry(new RegistryConfig("zookeeper://192.168.1.203:2181"));<br>
运行报错，错误位于 AbstractInterfaceConfig::useRegistryForConfigIfNecessary<br>
的 628 行<br>
cc.getParameters().put(org.apache.dubbo.remoting.Constants.CLIENT_KEY,rc.getClient());<br>
提示 rc.getClient() 为空</p>
</li>
<li>
<p dir="auto">使用 nacos 正常,修改代码，编译运行正常<br>
service.setRegistry(new RegistryConfig("nacos://192.168.1.207:8848"));</p>
</li>
<li>
<p dir="auto">dubbo-demo-xml-provider 也是相同的错误</p>
</li>
</ol>
<p dir="auto">Pls. provide [GitHub address] to reproduce this issue.</p>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">What do you expected from the above steps？</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">What actually happens?</p>
<p dir="auto">If there is an exception, please attach the exception trace:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Just put your stack trace here!
Exception in thread &quot;main&quot; java.lang.NullPointerException
	at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$null$7(AbstractInterfaceConfig.java:628)
	at java.util.Optional.orElseGet(Optional.java:267)"><pre class="notranslate"><code class="notranslate">Just put your stack trace here!
Exception in thread "main" java.lang.NullPointerException
	at org.apache.dubbo.config.AbstractInterfaceConfig.lambda$null$7(AbstractInterfaceConfig.java:628)
	at java.util.Optional.orElseGet(Optional.java:267)
</code></pre></div>