You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

GRPC Greeter Service示例随机失败,报Method not found错误求助

GRPC示例请求成功率异常:仅75%成功,剩余报错"Method not found!"

问题详情

测试GRPC官方示例代码时,客户端请求成功率仅约75%,剩余25%请求失败,抛出如下错误:

grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
        status = StatusCode.UNIMPLEMENTED
        details = "Method not found!"
        debug_error_string = "UNKNOWN:Error received from peer  {grpc_message:"Method not found!", grpc_status:12, created_time:"2024-06-12T10:16:43.243776013+03:00"}"

预期所有请求100%成功,未对示例代码做任何修改,代码通过以下命令克隆:

git clone -b v1.64.0 --depth 1 --shallow-submodules https://github.com/grpc/grpc

环境信息

  • 主机系统:Linux(Manjaro)
  • 网络环境:客户端与服务器运行在同一机器的不同终端
  • 防火墙规则:已配置允许本地相关通信
  • Python版本:
python --version
Python 3.12.3
  • 依赖版本:
pip freeze
grpcio==1.64.1
grpcio-tools==1.64.1
protobuf==5.27.1
setuptools==70.0.0

排查与解决建议

  1. 对齐GRPC版本:克隆的grpc仓库是v1.64.0,但安装的grpcio/grpcio-tools是1.64.1,小版本差异可能引发方法映射不兼容。执行以下命令降级依赖:
pip install grpcio==1.64.0 grpcio-tools==1.64.0
  1. 降级Protobuf版本:grpc v1.64.x推荐搭配protobuf 4.x系列(如4.25.3),当前安装的5.27.1版本过高,可能导致方法解析异常。降级命令:
pip install protobuf==4.25.3
  1. 检查服务注册完整性:查看服务器启动日志,确认所有服务方法都已成功注册,无遗漏情况。

  2. 排查端口占用:用lsof -i :50051(替换为你实际使用的GRPC端口)检查端口是否被其他进程占用,确保只有目标GRPC服务器在监听该端口。

内容的提问来源于stack exchange,提问作者Alp

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.22 11:50:16