From 25c6d44a98ddd3573942907aaf0c48c4465299bc Mon Sep 17 00:00:00 2001 From: Drew Erny Date: Wed, 31 Oct 2018 14:03:01 -0500 Subject: [PATCH] Increase grpc max recv message size Increases the maximum recieved message size for gRPC client connections to math.MaxInt32. This means that large controlapi List requests will be proxied correctly. Signed-off-by: Drew Erny --- manager/state/raft/transport/transport.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/manager/state/raft/transport/transport.go b/manager/state/raft/transport/transport.go index 72cf073ba5..6bd0bc32ef 100644 --- a/manager/state/raft/transport/transport.go +++ b/manager/state/raft/transport/transport.go @@ -4,6 +4,7 @@ package transport import ( "context" + "math" "net" "sync" "time" @@ -354,6 +355,15 @@ func (t *Transport) dial(addr string) (*grpc.ClientConn, error) { return net.DialTimeout("tcp", addr, timeout) })) + // TODO(dperny): this changes the max received message size for outgoing + // client connections. this means if the server sends a message larger than + // this, we will still accept and unmarshal it. i'm unsure what the + // potential consequences are of setting this to be effectively unbounded, + // so after docker/swarmkit#2774 is fixed, we should remove this option + grpcOptions = append(grpcOptions, grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32), + )) + cc, err := grpc.Dial(addr, grpcOptions...) if err != nil { return nil, err