Skip to content

session: serve the session with grpc's transport so streams apply flow control - #7437

Merged
crazy-max merged 3 commits into
moby:masterfrom
tonistiigi:session-flow-control
Nov 19, 2026
Merged

crazy-max merged 3 commits into
moby:masterfrom
tonistiigi:session-flow-control

Conversation

@tonistiigi

Copy link
Copy Markdown
Member

carry #7436
closes #7436
closes #7435

@fedor-rubalskiy

fedor-rubalskiy and others added 3 commits November 17, 2026 16:19
…w control

The session's gRPC server was served through ServeHTTP on an x/net/http2
server. grpc-go's ServeHTTP transport reads request bodies eagerly into an
unbounded buffer and returns flow-control credit as it reads, so a stream
the handler consumes slowly never pushes back on the sender. An export to
the client (type=oci/docker/tar with dest=) that the client writes slower
than the daemon sends grows the client's memory by the backlog, up to the
whole export.

Serve the connection with grpc.Server.Serve on a listener that hands out
that one connection, so grpc's own transport applies flow control. The
x/net/http2 server and its header-count setup are no longer needed: grpc's
transport has no per-value header count limit.

Fixes moby#7435

Signed-off-by: Fedor Rubalskiy <245945217+fedor-rubalskiy@users.noreply.github.com>
Set an explicit 1 MiB header-list limit on the session gRPC
server, matching the previous HTTP/2 server's budget.

This keeps large filesync pattern lists working when
GRPC_GO_EXPERIMENTAL_ENABLE_8KB_DEFAULT_HEADER_LIST_SIZE=true.
The smaller default was introduced in grpc/grpc-go#9019.

See grpc/grpc-go#9019

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Extend the flow-control test to release the blocked reader,
check sender errors, and verify the received byte count and
successful stream completion.

This prevents stream failures or permanent stalls from being
mistaken for working flow control.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@crazy-max crazy-max modified the milestones: v0.36.0, v0.35.1 Nov 18, 2026
@crazy-max
crazy-max merged commit b6c1c1a into moby:master Nov 19, 2026
213 checks passed
@crazy-max crazy-max modified the milestones: v0.35.1, v0.36.0 Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

session: exports to the client buffer without limit when the client writes slower than the daemon sends

3 participants