kitex icon indicating copy to clipboard operation
kitex copied to clipboard

调用 server.Stop() 时疑似对应 Stream 不会关闭

Open TreeFalling opened this issue 2 years ago • 9 comments

Describe the bug

调用 server.Stop() 后,对应 Stream 的 ReadMsg() 不会读出 err

To Reproduce

Steps to reproduce the behavior:

  1. Go to 'https://github.com/TreeFalling/kitex-issue'
  2. Git clone
  3. run main
  4. See the outputs

Expected behavior

count 先 5,再 0

Kitex version:

v0.6.0

Environment:

GOVERSION=go1.19.8

大概率是我没正确使用吧,但自己确实搞不明白了。以及若想得到预期效果,大概要怎么写呢

TreeFalling avatar Jun 14 '23 11:06 TreeFalling

的确,这是由于*nphttp2.svrTransHandler没有实现remote.GracefulShutdown接口导致,调用svr.Stop()无法真正关闭server的connection。如果你有解法,欢迎来个ap~

jayantxie avatar Jun 16 '23 11:06 jayantxie

我是小白,想请教一下,这个问题持续存在的原因,是涉及的已有逻辑或设计模式太多所以很难改吗,还是说这个关闭连接的需求没有太大的必要性呢,因为我印象里 gRPC 框架是可以强制关闭服务器和对应连接的

TreeFalling avatar Jun 20 '23 01:06 TreeFalling

这个问题原因就是nphttp2.svrTransHandler没有实现remote.GracefulShutdown接口,其实要修复也简单,就是让nphttp2.svrTransHandler实现remote.GracefulShutdown接口就行了,在remote.GracefulShutdown函数内把gRPC连接用goaway关闭。感兴趣的话可以给我们提个pr

jayantxie avatar Jun 26 '23 08:06 jayantxie

这个问题原因就是_nphttp2.svrTransHandler没有实现remote.GracefulShutdown接口,其实要修复也简单,就是让_nphttp2.svrTransHandler实现remote.GracefulShutdown接口就行了,在remote.GracefulShutdown函数内把gRPC连接用goaway关闭。感兴趣的话可以给我们提个pr

这个问题有实现的计划吗

someview avatar Nov 22 '23 00:11 someview

这个问题原因就是_nphttp2.svrTransHandler没有实现remote.GracefulShutdown接口,其实要修复也简单,就是让_nphttp2.svrTransHandler实现remote.GracefulShutdown接口就行了,在remote.GracefulShutdown函数内把gRPC连接用goaway关闭。感兴趣的话可以给我们提个pr

这个问题有实现的计划吗

我当时尝试实现,失败了,只记得好像不止 Jayant 说得那么简单(也可能是我太菜)

TreeFalling avatar Nov 22 '23 00:11 TreeFalling

这个问题原因就是_nphttp2.svrTransHandler没有实现remote.GracefulShutdown接口,其实要修复也简单,就是让_nphttp2.svrTransHandler实现remote.GracefulShutdown接口就行了,在remote.GracefulShutdown函数内把gRPC连接用goaway关闭。感兴趣的话可以给我们提个pr

这个问题有实现的计划吗

我当时尝试实现,失败了,只记得好像不止 Jayant 说得那么简单(也可能是我太菜)

OK,我看一下这个问题

jayantxie avatar Nov 23 '23 02:11 jayantxie

这个问题原因就是_nphttp2.svrTransHandler没有实现remote.GracefulShutdown接口,其实要修复也简单,就是让_nphttp2.svrTransHandler实现remote.GracefulShutdown接口就行了,在remote.GracefulShutdown函数内把gRPC连接用goaway关闭。感兴趣的话可以给我们提个pr

这个问题有实现的计划吗

我当时尝试实现,失败了,只记得好像不止 Jayant 说得那么简单(也可能是我太菜)

OK,我看一下这个问题 急需这个问题。stop这个功能肯定不正常,我敢保证. 刚换上kitex的服务端,1个是stop时bidistream无法关闭, 一个是我在另外一个issue里面提到的在关闭listener的时候有os.exit(1)导致程序异常退出了

someview avatar Nov 24 '23 05:11 someview

ok,后面那个问题我回你了,这个stop问题我先记下

jayantxie avatar Nov 24 '23 07:11 jayantxie

@jayantxie any progress ?

GuangmingLuo avatar Feb 22 '24 03:02 GuangmingLuo

fixed at https://github.com/cloudwego/kitex/pull/1556.

jayantxie avatar Apr 07 '25 07:04 jayantxie