From 576861e61757aa87479422e44f4d348c5a1d43a9 Mon Sep 17 00:00:00 2001 From: spacewander Date: Thu, 3 Jun 2021 16:36:19 +0800 Subject: [PATCH] embed: unlimit the recv msg size of grpc-gateway Ensure the client which access etcd via grpc-gateway won't be limited by the MaxCallRecvMsgSize. Here we choose the same default value of etcdcli as grpc-gateway's MaxCallRecvMsgSize. Fix https://github.com/etcd-io/etcd/issues/12576 --- server/embed/serve.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/embed/serve.go b/server/embed/serve.go index 23e115d6a5e..17b55384ebb 100644 --- a/server/embed/serve.go +++ b/server/embed/serve.go @@ -19,6 +19,7 @@ import ( "fmt" "io/ioutil" defaultLog "log" + "math" "net" "net/http" "strings" @@ -222,6 +223,10 @@ func (sctx *serveCtx) registerGateway(opts []grpc.DialOption) (*gw.ServeMux, err addr = fmt.Sprintf("%s://%s", network, addr) } + opts = append(opts, grpc.WithDefaultCallOptions([]grpc.CallOption{ + grpc.MaxCallRecvMsgSize(math.MaxInt32), + }...)) + conn, err := grpc.DialContext(ctx, addr, opts...) if err != nil { return nil, err