gpt4 book ai didi

.net - grpc方法调用错误: Failed to pick subchannel

转载 作者:行者123 更新时间:2023-12-05 01:28:54 28 4
gpt4 key购买 nike

gRpc 客户端: python :3.8grpcio: 1.38.1

gRpc 服务器:点网核心5.0负载均衡器AKS:1.19.7

当我的 python 客户端调用一个方法时,我遇到了以下错误。非常感谢任何解决问题的帮助。

Python 代码片段

with open('chain.pem', 'rb') as f:
trusted_certs = f.read()

credentials = channel = grpc.ssl_channel_credentials(root certificates=trusted_certs)

# 10.200.3.24 is the K8S service IP with 3 replicas
channel = grpc.secure_channel('10.200.3.24:443', credentails, options=(('grpc.enable_http_proxy', 0),))

stub = query_pb2_grpc.QueryStub(channel)

empty = google_dot_protobuf_dot_empty__pb2.Empty()
data = stub.TestMethod(empty)

错误

_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNAVAILABLE
details = "Empty update"
debug_error_string = "{"created":"@1625180429.368158115","description":"Failed to pick subchannel","file":"src/core/ext/filters/client_channel/client_channel.cc","file_line":3008,"referenced_errors":[{"created":"@1625178894.878505214","description":"Empty update","file":"src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc","file_line":201,"grpc_status":14}]}"
>

最佳答案

现在已经解决了。更新它是否可以帮助遇到类似问题的任何人。首先使用以下两个导出启用 gRpc 跟踪,然后运行您的代码,详细查看错误。

export GRPC_TRACE=all
export GRPC_VERBOSITY=DEBUG

在我的例子中,存在以下错误

handshake failed: {"created":"@1582571630.967438000","description":"Peer 
name 10.200.3.24 is not in peer certificate", "file":
"src/core/lib/security/security_connector/ssl/ssl_security_connector.cc",
"file_line":55}

我的服务器自签名证书 (subject:/C=US/ST=US/O=Self Signed/CN=10.100.3.250) 没有 subjectAltName 扩展名。添加 subjectAltName 扩展名 (IP.1=10.100.3.250) 后,一切正常。

关于.net - grpc方法调用错误: Failed to pick subchannel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68217975/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com