-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
服务重启导致客户端无法访问服务 #270
Comments
Hi @ujjboy , |
sorry, add the client's error: could u help me with it? tnks a lot. @ujjboy @lifesinger @popomore @khotyn |
@lxl0044 you mean use zookeeper as registry, and |
@ujjboy thks for resp so fast. |
No, it's normal case. Can you provide your demo for reproduce this ? and more logs in |
@ujjboy Have u ever had this problem in u'r tests? Sorry, there are some other things in my demo that are not very convenient to upload, but the logic is like this: // client:##### properties ##### ##### Client.java #####
}` ##### pom.xml ##### // server:##### TestApi.java ##### ##### TestApiImpl.java ##### ============================================== |
@lxl0044 I need more logs in |
@ujjboy hi, i upload my demo, link: any questions call me any time, thks a lot. :-) |
Hi @ujjboy @lifesinger @popomore @khotyn , |
@lxl0044 I will follow this case. Can you upload the log file |
I tried your code and nothing happened, something like that: I just change
to
|
After I review the code, maybe there is one possibility: the old provider(killed server) deleted event is after new provider (restarted server) added event. @lxl0044 I need your log in |
Hi @ujjboy , |
Dear @liangyuanpeng , this is my detailed steps: you can try like it, i'm not sure what's wrong, but really error, so sad.. |
@lxl0044 I read this log, and as I guess, the remove event is later than the add event. I will new issue and fix it.
|
@ujjboy |
Describe the bug
服务(provider)非优雅方式重启(kill -9 $pid & startup)时,客户端再次调用,出现如下报错
ERROR 2018-08-17 10:12:22,439 http-nio-30001-exec-10 org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]:181 - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.alipay.sofa.rpc.core.exception.SofaRouteException: RPC-02306: 没有获得服务[com.choice.balance.api.BalanceApi:1.0]的调用地址,请检查服务是否已经推送 ] with root cause com.alipay.sofa.rpc.core.exception.SofaRouteException: RPC-02306: 没有获得服务[com.lotoblock.balance.api.BalanceApi:1.0]的调用地址,请检查服务是否已经推送 at com.alipay.sofa.rpc.client.AbstractCluster.noAvailableProviderException(AbstractCluster.java:418) ~[sofa-rpc-all-5.4.3.jar!/:5.4.3]
Expected behavior
期望暴力重启情况下,服务依然可以被调用
Actual behavior
在一定时间内(20秒内),kill -9 后直接重启,出现服务不可调用
原因
1、服务端zookeeker上生成的节点为
CreateMode.EPHEMERAL
类型,session中断时,客户端的会监听到remove时间,并删除客户端的对失效服务的链接。2、服务端内存中同时维护每个providerInfo的信息,且key是一个对象。客户端接收到新的链接(provider)时,从内存先查,如果没有才创建。
3、在客户端没有remove失效的provider前,根据配置信息,会先查询到服务关闭之前的链接。即会出现此现象
处理方式
1、服务优雅重启
2、修改代码,ProviderInfo,或者reconnect检查时,删除com.alipay.sofa.rpc.transport.bolt.BoltClientConnectionManager.urlConnectionMap中无效链接,并重新初始化。
Environment
java -version
): 1.8uname -a
): LinuxThe text was updated successfully, but these errors were encountered: