Skip to content
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

rpc provider应用重启后问题 #178

Closed
jinchaoxiang opened this issue Jun 14, 2018 · 18 comments
Closed

rpc provider应用重启后问题 #178

jinchaoxiang opened this issue Jun 14, 2018 · 18 comments
Labels
bug Something isn't working question Further information is requested

Comments

@jinchaoxiang
Copy link

Your question

更新rpc provider应用时,是否需要优雅关闭
因为我在本地每当重启rpc provider应用后,rpc consumer就找不到对应的服务了,不知道是不是没有使用优雅关闭的问题
2018-06-14 09:21:12.575 WARN 2316 --- [rker-1-thread-1] c.a.remoting.DefaultConnectionManager : Remove and close the last connection in ConnectionPool with poolKey 172.16.249.78:12200
这是重启rpc provider应用的info

Your scenes

describe your use scenes (why need this feature)

Your advice

describe the advice or solution you'd like

Environment

  • SOFARPC version:
  • JVM version (e.g. java -version):
  • OS version (e.g. uname -a):
  • Maven version:
  • IDE version:
@liangyuanpeng
Copy link
Contributor

liangyuanpeng commented Jun 14, 2018

我尝试使用QuickStartClient和QuickStartServer重现你的问题,没有出现这个问题

1.启动QuickStartServer
2.启动QuickStartClient
3.运行一段时间后关闭QuickStartServer并重启QuickStartServer

使用的是bolt协议

你说的这个可以怎么重现

对了,我使用的sofa-rpc版本是5.4.0,windows环境下1.8的jdk

@jinchaoxiang
Copy link
Author

1.首先我是本地两个应用 分别是QuickStartServer,QuickStartClient ,注册中心用的是zookeeper
2.启动QuickStartServer
3.启动QuickStartClient
4.运行一段时间后关闭QuickStartServer并重启QuickStartServer
使用的是bolt协议
sofaboot-dependencies 2.4.0|rpc-sofa-boot-starter
jdk1.8
Idea debug模式
重启server后的client的提示信息如下
2018-06-14 09:42:58.665 WARN 5156 --- [rker-1-thread-1] c.a.remoting.DefaultConnectionManager : Remove and close the last connection in ConnectionPool with poolKey 172.16.249.78:12200
client访问结果如下
{
"success": false,
"message": "RPC-02306: 没有获得服务[com.ransyh.rpc.service.integral.IIntegralService:1.0]的调用地址,请检查服务是否已经推送 ",
"result": null,
"code": "210"
}
@liangyuanpeng

@jinchaoxiang
Copy link
Author

现在解决这个问题 我这边需要重启client才能重新调用服务

@jinchaoxiang
Copy link
Author

我发现有可能是因为客户端还是使用了直连的方式 可是我的客户端也做了如下的配置
com:
alipay:
sofa:
rpc:
registry-address: zookeeper://172.16.50.200:2181
请问客户端连接zookeeper还需要做其他配置或者引入相应的架包吗?
@liangyuanpeng

@liangyuanpeng
Copy link
Contributor

rpc-sofa-boot-starter 我使用得不多呢,不太清楚具体原因,

同时我也有看到你到sofa-rpc-boot-project项目下发起你的提问

相信官方人员或其他热心开发者很快就能帮助你解决你的问题

@JervyShi JervyShi added the question Further information is requested label Jun 14, 2018
@JervyShi
Copy link
Member

@jinchaoxiang 我通过你的描述复现了你的问题,使用 zookeeper 做服务发现时可以先去掉 consumer 的 setDirectUrl 配置,去掉后可正常通过 zookeeper 服务发现找到重启后的 QuickStartServer 地址,这两个配置的冲突点我再确认下。

@ujjboy ujjboy added the bug Something isn't working label Jun 14, 2018
@jinchaoxiang
Copy link
Author

setDirectUrl这个配置我没有显示配置 就是说默认是开启的 我需要显示配置false关掉吗
@JervyShi

@JervyShi
Copy link
Member

@jinchaoxiang QuickStartClient 中是有设置的,我在设置的同时配置 Zookeeper 做服务发现重现了你描述的现象。使用 API 方式不主动 setDirectUrl 不会生效,不需要显示配置 false。

@jinchaoxiang
Copy link
Author

那我用的是springboot项目的maven包 用的是yaml配置
需要如何修改
@JervyShi

@jinchaoxiang
Copy link
Author

@JervyShi
还是不行 即使通过API的配置方式 重启后会重新连上 但连接的时间就那么几秒 几秒后自动断开连接了
2018-06-14 16:42:01.509 WARN 7220 --- [ChildrenCache-2] c.a.remoting.DefaultConnectionManager : Remove and close all connections in ConnectionPool of poolKey=172.16.249.78:22101
2018-06-14 16:42:01.510 WARN 7220 --- [rker-1-thread-2] c.a.remoting.DefaultConnectionManager : Remove and close a standalone connection.
这是几秒后的info

@jinchaoxiang
Copy link
Author

无解了
2018-06-14 17:28:30.680 WARN 8572 --- [rker-1-thread-1] c.a.remoting.DefaultConnectionManager : Remove and close the last connection in ConnectionPool with poolKey 172.16.249.78:12200
2018-06-14 17:29:00.399 WARN 8572 --- [ChildrenCache-2] c.a.remoting.DefaultConnectionManager : Remove and close all connections in ConnectionPool of poolKey=172.16.249.78:12200
2018-06-14 17:29:00.400 WARN 8572 --- [rker-1-thread-2] c.a.remoting.DefaultConnectionManager : Remove and close a standalone connection.
一直都是这个问题,有没有官方的人出来解答下

@liangyuanpeng
Copy link
Contributor

可以把你这个项目工程的代码上传到你的github仓库,方便问题的重现

@ujjboy
Copy link
Member

ujjboy commented Jun 14, 2018

@jinchaoxiang  代码上传我们跑下看看。你用的是zookeeper做注册中心是吧?

Remove and close 一般是长连接断开才打印的。

@jinchaoxiang
Copy link
Author

@ujjboy
您好 项目已经上传到github我的主页 对应的目录分别是 eepay和integral 请查阅

@liangyuanpeng
Copy link
Contributor

liangyuanpeng commented Jun 15, 2018

eepay项目的SpringUtil没有上传吧

存在com.ransyh的web包下的

@jinchaoxiang
Copy link
Author

在integral中加了web.jar包 这些类都在这个jar中
我本地有测试了 发现原因还是在consumer没有到zookeeper上找服务 还是都在本地找的原因造成的
@liangyuanpeng

@liangyuanpeng
Copy link
Contributor

建议你将rpc部分代码抽离出来,不要与你自己的服务器有关联,

同时也建议不要将自己的服务器IP暴露出来,以免遭受有心人利用

这样问题才会比较好排查

@jinchaoxiang

@davis1214
Copy link

服务重启时,客户端没有及时删除链接信息导致。服务关闭时,尝试等待一段时间再重启。

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants