4MB client side limit was introduced in vendoring go-grpc#1165 (v1.4.0)
making these requests likely to produce errors
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
| ... | ... |
@@ -41,6 +41,7 @@ package cluster // import "github.com/docker/docker/daemon/cluster" |
| 41 | 41 |
import ( |
| 42 | 42 |
"context" |
| 43 | 43 |
"fmt" |
| 44 |
+ "math" |
|
| 44 | 45 |
"net" |
| 45 | 46 |
"os" |
| 46 | 47 |
"path/filepath" |
| ... | ... |
@@ -67,9 +68,10 @@ const stateFile = "docker-state.json" |
| 67 | 67 |
const defaultAddr = "0.0.0.0:2377" |
| 68 | 68 |
|
| 69 | 69 |
const ( |
| 70 |
- initialReconnectDelay = 100 * time.Millisecond |
|
| 71 |
- maxReconnectDelay = 30 * time.Second |
|
| 72 |
- contextPrefix = "com.docker.swarm" |
|
| 70 |
+ initialReconnectDelay = 100 * time.Millisecond |
|
| 71 |
+ maxReconnectDelay = 30 * time.Second |
|
| 72 |
+ contextPrefix = "com.docker.swarm" |
|
| 73 |
+ defaultRecvSizeForListResponse = math.MaxInt32 // the max recv limit grpc <1.4.0 |
|
| 73 | 74 |
) |
| 74 | 75 |
|
| 75 | 76 |
// NetworkSubnetsProvider exposes functions for retrieving the subnets |
| ... | ... |
@@ -23,6 +23,7 @@ import ( |
| 23 | 23 |
gogotypes "github.com/gogo/protobuf/types" |
| 24 | 24 |
"github.com/pkg/errors" |
| 25 | 25 |
"github.com/sirupsen/logrus" |
| 26 |
+ "google.golang.org/grpc" |
|
| 26 | 27 |
) |
| 27 | 28 |
|
| 28 | 29 |
// GetServices returns all services of a managed swarm cluster. |
| ... | ... |
@@ -67,7 +68,9 @@ func (c *Cluster) GetServices(options apitypes.ServiceListOptions) ([]types.Serv |
| 67 | 67 |
|
| 68 | 68 |
r, err := state.controlClient.ListServices( |
| 69 | 69 |
ctx, |
| 70 |
- &swarmapi.ListServicesRequest{Filters: filters})
|
|
| 70 |
+ &swarmapi.ListServicesRequest{Filters: filters},
|
|
| 71 |
+ grpc.MaxCallRecvMsgSize(defaultRecvSizeForListResponse), |
|
| 72 |
+ ) |
|
| 71 | 73 |
if err != nil {
|
| 72 | 74 |
return nil, err |
| 73 | 75 |
} |
| ... | ... |
@@ -8,6 +8,7 @@ import ( |
| 8 | 8 |
types "github.com/docker/docker/api/types/swarm" |
| 9 | 9 |
"github.com/docker/docker/daemon/cluster/convert" |
| 10 | 10 |
swarmapi "github.com/docker/swarmkit/api" |
| 11 |
+ "google.golang.org/grpc" |
|
| 11 | 12 |
) |
| 12 | 13 |
|
| 13 | 14 |
// GetTasks returns a list of tasks matching the filter options. |
| ... | ... |
@@ -53,7 +54,9 @@ func (c *Cluster) GetTasks(options apitypes.TaskListOptions) ([]types.Task, erro |
| 53 | 53 |
|
| 54 | 54 |
r, err = state.controlClient.ListTasks( |
| 55 | 55 |
ctx, |
| 56 |
- &swarmapi.ListTasksRequest{Filters: filters})
|
|
| 56 |
+ &swarmapi.ListTasksRequest{Filters: filters},
|
|
| 57 |
+ grpc.MaxCallRecvMsgSize(defaultRecvSizeForListResponse), |
|
| 58 |
+ ) |
|
| 57 | 59 |
return err |
| 58 | 60 |
}); err != nil {
|
| 59 | 61 |
return nil, err |