grpc:接收到的消息超过了最大限制(4623947 vs. 4194304)

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

grpc: received message larger than max (4623947 vs. 4194304)

问题

请帮助我
我已经尝试了一切
GRPC的设置都已经指定了,他还需要我提供什么?

// client
sock, err := grpc.Dial(
    config.Parser,
    grpc.WithInsecure(),
    grpc.WithDefaultCallOptions(
        grpc.MaxCallRecvMsgSize(20*1024*1024), 
        grpc.MaxCallSendMsgSize(20*1024*1024)))
//...
m, err := d.Parser.UpdateSources(
    ctx,
    movie,
    grpc.MaxCallSendMsgSize(10*1024*1024), 
    grpc.MaxCallRecvMsgSize(10*1024*1024))

GRPC仍然报告消息过大的问题,从错误信息可以看出,设置没有生效
我还在服务器上添加了选项

rpc := grpc.NewServer(
    grpc.MaxSendMsgSize(1024*1024*20), 
    grpc.MaxSendMsgSize(1024*1024*20))

结果
>rpc错误:code = ResourceExhausted desc = grpc:接收到的消息大于最大值(4623947 vs. 4194304)

GRPC版本为v1.41.0

英文:

Please help me
I've tried everything already
The grps settings are all indicated what else he requires from me

// client
sock, err := grpc.Dial(
    config.Parser,
    grpc.WithInsecure(),
    grpc.WithDefaultCallOptions(
        grpc.MaxCallRecvMsgSize(20*1024*1024), 
        grpc.MaxCallSendMsgSize(20*1024*1024)))
//...
m, err := d.Parser.UpdateSources(
    ctx,
    movie,
    grpc.MaxCallSendMsgSize(10*1024*1024), 
    grpc.MaxCallRecvMsgSize(10*1024*1024))

grps still swears at a large message and, as you can see from the error, the settings were not applied
I also added options on the server

rpc := grpc.NewServer(
    grpc.MaxSendMsgSize(1024*1024*20), 
    grpc.MaxSendMsgSize(1024*1024*20))

result
>rpc error: code = ResourceExhausted desc = grpc: received message larger than max (4623947 vs. 4194304)

version grpc v1.41.0

答案1

得分: 2

问题已经解决。
我忘记设置 grpc.MaxRecvMsgSize(1024*1024*20)
我在服务器端写了两次 grpc.MaxSendMsgSize(1024*1024*20)
因为一个小错误整夜都浪费了。

英文:

The problem has been resolved.
i missed setting grpc.MaxRecvMsgSize(1024*1024*20)
I wrote twice grpc.MaxSendMsgSize(1024*1024*20) in server.
Lost all night due to a minor bug(

huangapple
  • 本文由 发表于 2021年10月21日 09:54:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/69654944.html
匿名

发表评论

匿名网友

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

确定