1.问题描述
在学习grpc官方文档的时候,发生了一个问题,就是client端迟迟没有反应并且最终会报错,错误如下:
Traceback (most recent call last):
File "greeter_client.py", line 37, in <module>
run()
File "greeter_client.py", line 31, in run
response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))
File "/Users/wengzhenxi/Library/Python/3.6/lib/python/site-packages/grpc/_channel.py", line 565, in __call__
return _end_unary_response_blocking(state, call, False, None)
File "/Users/wengzhenxi/Library/Python/3.6/lib/python/site-packages/grpc/_channel.py", line 467, in _end_unary_response_blocking
raise _Rendezvous(state, None, None, deadline)
grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "Socket closed"
debug_error_string = "{"created":"@1563958480.003440000","description":"Error received from peer ipv4:127.0.0.1:1087","file":"src/core/lib/surface/call.cc","file_line":1052,"grpc_message":"Socket closed","grpc_status":14}"
>
2.错误分析
这是一个中国程序员可能会出现的问题。
首先在google上没有找到答案。(因为外国同志不会遇到)
后来认真研究了一下错误,发现这一条:
"description":"Error received from peer ipv4:127.0.0.1:1087"
表示没有received 到什么东西从1087端口,但是我client端明明是通过50051去请求的。看着1087越看越熟悉。。。我为了看外面的世界,设置了全局代理......去掉代理,解决。
全局代理的坑
3.结束
希望对大家有用。
网友评论