fix(grpc-data): transport receive bound follows the call's decode limit (#963)

Grpc.Net.Client has no per-call receive limit, so Read/GetMetadata/Browse now go
through receive-bounded sibling channels (power-of-two size classes, min 16 KiB,
sharing the endpoint channel's handler). An oversized response to a scalar read is
refused from its length prefix instead of buffering up to MaxMessageBytes; such a
refusal stays a decode refusal (ArgumentException, no failover).
This commit is contained in:
Joseph Doherty
2026-12-01 21:11:38 -05:00
parent 60e1328218
commit 1724a175b6
5 changed files with 362 additions and 10 deletions
+10 -1
View File
@@ -50,7 +50,16 @@ variable-length array has no declared bound and still reserves the whole per-rea
(`min(4 MiB, MaxPendingBytes)`), so such reads run one at a time at the default; a read of that kind
that is waiting for capacity holds back smaller reads for 100 ms (re-armed while it waits) so a steady
stream of scalar reads cannot starve it. The reservation is also the read's decode limit, so an
origin answering more than the node's shape allows is refused rather than exceeding the bound. A
origin answering more than the node's shape allows is refused rather than exceeding the bound. **Since
#963** the gRPC transport enforces the same bound before buffering: a Read / GetMetadata / Browse
response is refused from its gRPC length prefix when it exceeds the call's decode limit rounded up to
a power of two (min 16 KiB, so a scalar read's transport bound is exactly its 16 KiB reservation; a
fixed-array read's at most 2 × its reservation), instead of first buffering up to the channel's
`MaxMessageBytes` — 64 concurrent scalar reads can no longer pin 64 × 4 MiB of transport buffers.
Grpc.Net.Client has no per-call receive limit, so each size class is a sibling channel sharing the
endpoint channel's handler (one connection pool). Such a refusal is a decode refusal (no endpoint
failover or discovery back-off), as before; a response over the channel maximum keeps its existing
endpoint-failure handling. A
projected Write likewise reserves what its value needs (16 KiB + identifiers + 3 × the value's
size bound — the budget the origin admits a write batch against), not the whole cap. A read that is not answered in time, or answers nothing servable (unreachable, not
ready, older than the mapping's stale timeout), returns `BadWaitingForInitialData` as before; a