Beispiel
Configure gRPC-Go client and server receive message size limits to handle payloads exceeding the default 4MB limit
sha256:2a0fa7cb93fe3b863e2520ac8f3cb87f14c3964a07c329047abda9a63073769d
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Ausführungsbelege
Deklarierte Umgebung und signierte Prüfläufe werden getrennt dargestellt.
BeleggrundlageSignierter Vertrag bestanden
Verifizierungsbelege1
VerifizierungsstufeL3_CONTRACT_PASS
Deklarierte Umgebung
- Ausführungskontext
- go 1.26
- Betriebssystem
- linux
- Architektur
- x64
- Runtime
- go 1.26
- Sprache
- go
- Paketmanager
- go
Umgebungen der Verifizierungsläufe
- Ausführungskontext
- go 1.26
- Betriebssystem
- linux alpine · musl
- Architektur
- x64
- Runtime
- go 1.26
- Sprache
- go
- Paketmanager
- go
- Ausführung
- container · docker
CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17
Fall
- Ziel
- Configure gRPC-Go client and server receive message size limits to handle payloads exceeding the default 4MB limit HOW
- Pakete
-
google.golang.org/grpc v1.83.0
google.golang.org/protobuf v1.36.11
- Umgebung
- go 1.26
- Erstellt
- 2026-08-17T11:54:02Z
Häufige Annahme
A client can receive responses larger than 4MB without additional configuration because the default 4MB limit applies only to server request payloads, or by setting grpc.MaxCallSendMsgSize on the client.
So hat der Autor des Samples festgehalten, was eine Entwicklerin oder ein Modell hier erwarten würde. Der Vertrag darunter ist das, was tatsächlich lief.
Contract
- When a gRPC server returns a 5MB payload to a client with default options, the server transmits it without error but the client fails to decode the response with status code ResourceExhausted because the default client-side receive limit is 4MB.
- Configuring grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(10*1024*1024)) on the client does not permit receiving 5MB responses and still results in ResourceExhausted.
- Configuring grpc.WithDefaultCallOptions(grpc.MaxCallRecvMsgSize(10*1024*1024)) or passing grpc.MaxCallRecvMsgSize to Invoke allows the client to successfully receive the 5MB response.
- Sending a 5MB request from a client to a server with default options causes the server to reject the incoming message with status code ResourceExhausted unless the server is configured with grpc.MaxRecvMsgSize.
Dateien
- NOTES.md
- csx.json
- go.mod
- go.sum
- message_size_test.go
Quellartefakt herunterladen (tar.gz)
Ursprungs-Seeder
csx-seed
Verifizierungsbelege
- go 1.26 · linux alpine/x64 · docker · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · golang@1 · 2026-08-17 · ed25519:d91480838ac982c9