Skip to content

Commit cdbfae1

Browse files
committed
api/server/router/grpc: NewRouter: set correct MaxRecvMsgSize, MaxSendMsgSize
[buildkit@29b4b1a537][1] applied changes to `buildkitd` to set the correct defaults, which should be 16MB, but used the library defaults. Without that change, builds using large Dockerfiles would fail with a `ResourceExhausted` error; => [internal] load build definition from Dockerfile => => transferring dockerfile: 896.44kB ERROR: failed to receive status: rpc error: code = ResourceExhausted desc = grpc: received message larger than max (44865299 vs. 16777216) However those changes were applied to the `buildkitd` code, which is the daemon when running BuildKit standalone (or in a container through the `container` driver). When running a build with the BuildKit builder compiled into the Docker Engine, that code is not used, so the BuildKit changes did not fix the issue. This patch applies the same changes as were made in [buildkit@29b4b1a537][1] to the gRPC endpoint provided by the dockerd daemon. [1]: moby/buildkit@29b4b1a Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 951a04c commit cdbfae1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

api/server/router/grpc/grpc.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"os"
1010
"strings"
1111

12+
"github.com/containerd/containerd/defaults"
1213
"github.com/containerd/log"
1314
"github.com/docker/docker/api/server/router"
1415
"github.com/moby/buildkit/util/grpcerrors"
@@ -32,6 +33,8 @@ func NewRouter(backends ...Backend) router.Router {
3233
grpc.StatsHandler(tracing.ServerStatsHandler(otelgrpc.WithTracerProvider(otel.GetTracerProvider()))),
3334
grpc.ChainUnaryInterceptor(unaryInterceptor, grpcerrors.UnaryServerInterceptor),
3435
grpc.StreamInterceptor(grpcerrors.StreamServerInterceptor),
36+
grpc.MaxRecvMsgSize(defaults.DefaultMaxRecvMsgSize),
37+
grpc.MaxSendMsgSize(defaults.DefaultMaxSendMsgSize),
3538
}
3639

3740
r := &grpcRouter{

0 commit comments

Comments
 (0)