cloudwego / hertz

Go HTTP framework with high-performance and strong-extensibility for building micro-services.
https://www.cloudwego.io
Apache License 2.0
5.12k stars 496 forks source link

使用etcd做服务中心,hertz做api层rpc调用kitex,过一段时间后hertz自动退出,麻烦看下这是哪里出了问题? #1091

Closed 23buliuhu closed 4 months ago

23buliuhu commented 4 months ago

Describe the Question

api(hertz)调rpc, 可以成功调通,过一会之后,api打印 2024/04/15 10:29:16 remote or network error: default codec read failed: read tcp 127.0.0.1:49993->127.0.0.1:8888: wsarecv: An established connection was aborted by the software in your host machine. Debugger finished with the exit code 0

image

etcd版本:官网最新的 3.5.13

li-jin-gou commented 4 months ago

https://github.com/cloudwego/kitex/issues/932 相同

li-jin-gou commented 4 months ago

api 退出是不是因为,rpc 报错了,你的业务逻辑就退出了导致了...

23buliuhu commented 4 months ago

rpc没有报错,我加了超时配置,但还是没有解决 func InitRpc() { r, err := etcd.NewEtcdResolver([]string{"127.0.0.1:2379"}) // r不应重复使用。 if err != nil { log.Fatal(err) } BasicCoreClient, err = basiccoreservice.NewClient( "playgo.basic.core", client.WithResolver(r), client.WithRPCTimeout(time.Duration(5)*time.Second), client.WithConnectTimeout(time.Duration(5)*time.Second)) if err != nil { panic(err) } }

li-jin-gou commented 4 months ago

image

目前看结论是这个