“rpc错误:代码=不可用,描述=由于连接错误关闭传输”

huangapple go评论127阅读模式
英文:

"rpc error: code = Unavailable desc = closing transport due to: connection error"

问题

我正在使用k8来托管我的grpc服务。

有时候,在我的请求进行了几毫秒后,我会遇到以下错误:

rpc error: code = Unavailable desc = closing transport due to: connection error: desc = "error reading from server: read tcp <ipaddr>:52220-><internal ip addr>:8070: read: connection reset by peer", received prior goaway: code: NO_ERROR

我想问一下,这是怎么发生的?可能是k8的网络出了问题吗?

英文:

I am using k8 to host my grpc service.

Sometimes, I am getting the following error (few milliseconds into my request):

rpc error: code = Unavailable desc = closing transport due to: connection error: desc = &quot;error reading from server: read tcp &lt;ipaddr&gt;:52220-&gt;&lt;internal ip addr&gt;:8070: read: connection reset by peer&quot;, received prior goaway: code: NO_ERROR

May I ask how will this occur? Could it be that the k8's network is down?

答案1

得分: 2

这是因为在服务器关闭时,它会发送一个初始的GOAWAY来支持优雅关闭。这意味着你的服务器已经关闭了。

英文:

This happened because on server shutdown, it sends an initial GOAWAY to support graceful shutdown. This means your server shut down.

答案2

得分: 0

在我的情况下,我使用OpenShift进行部署。在本地环境中一切都很好。
我有用于不同环境的yaml文件,比如
development.yaml, staging.yaml, production.yaml

developent.yaml中,我使用localhost来连接微服务,即
auth_service_url: localhost:50051

在部署之前,我没有注意到这一点,因此导致了那个错误。

我只需将微服务的URL更新为指向**OpenShift服务名称**
auth_service_url: np-auth-service:50051 //其中np-auth-service是我OpenShift环境中的服务名称。

英文:

In my case I was using openshift for deployment. Everything was fine in local environment.
I have my yaml file for diff environments like

development.yaml, staging.yaml, production.yaml

In developent.yaml I used localhost to connect to microservices, i.e

auth_service_url: localhost:50051

And I didn't notice this before deployment and hence resulting in that error.

I just updated microservice url to point to openshift service name

auth_service_url: np-auth-service:50051 //where np-auth-service is a service name in my openshift environment.

huangapple
  • 本文由 发表于 2022年9月20日 20:37:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/73786833.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定