drpcmanager: cap concurrent streams with MaxStreams#74
Draft
suj-krishnan wants to merge 1 commit into
Draft
Conversation
suj-krishnan
force-pushed
the
sujatha/flow-control-max-streams
branch
from
July 1, 2026 16:25
76f6b5d to
d87ef7a
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-stream-enable
branch
from
July 13, 2026 07:00
094e417 to
e78b0d2
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-max-streams
branch
from
July 13, 2026 07:01
d87ef7a to
02f81c4
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-stream-enable
branch
from
July 13, 2026 07:06
e78b0d2 to
b1e1843
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-max-streams
branch
from
July 13, 2026 07:06
02f81c4 to
96b1758
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-stream-enable
branch
from
July 13, 2026 08:41
b1e1843 to
5a18815
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-max-streams
branch
from
July 13, 2026 08:41
96b1758 to
65d48d6
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-stream-enable
branch
from
July 13, 2026 08:47
5a18815 to
8f23265
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-max-streams
branch
from
July 13, 2026 08:47
65d48d6 to
b9f1367
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-stream-enable
branch
from
July 13, 2026 08:55
8f23265 to
8c03c23
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-max-streams
branch
from
July 13, 2026 08:55
b9f1367 to
bfa4cbe
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-stream-enable
branch
from
July 13, 2026 08:59
8c03c23 to
482d67b
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-max-streams
branch
from
July 13, 2026 08:59
bfa4cbe to
fd0c66a
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-stream-enable
branch
7 times, most recently
from
July 17, 2026 05:38
0ffae48 to
2f31d5f
Compare
suj-krishnan
force-pushed
the
sujatha/flow-control-max-streams
branch
3 times, most recently
from
July 20, 2026 09:12
6c845e7 to
5b303d7
Compare
Add Options.MaxStreams, a per-connection cap on how many concurrent streams a peer may open against this manager. When the cap is reached an inbound stream is refused in the read path -- before any per-stream state is allocated -- with a stream-level KindError, leaving the connection up. 0 means unlimited. This bounds the per-stream bookkeeping (goroutines, stream-table entries, window counters) that the byte-based flow-control windows do not, giving DoS resistance against a peer that opens many zero-byte streams. It is the third flow-control bound alongside the per-stream and connection windows, and is independent of the credit path. Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
suj-krishnan
force-pushed
the
sujatha/flow-control-max-streams
branch
from
July 20, 2026 15:18
5b303d7 to
88e78a0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caps the number of concurrent admitted streams a peer may open against this manager.
Options.MaxStreams(0 = unlimited). An inbound stream beyond the cap is refused in the read path with a stream-levelKindError, without admitting it or tearing down the connection. The reject is a normal (non-control) frame so it respects write-buffer backpressure: over-cap refusals are unbounded (a peer can flood over-cap invokes), so bypassing the buffer via the control bit would let them append pastMaximumBufferSize. A full buffer parks the reader, throttling the flooder.Merge safety: default 0 = unlimited, so a dependency bump changes nothing. Independent of flow control — a standalone gRPC-style
MaxConcurrentStreamsknob.Tests: refuses-excess-inbound; slot-frees-after-close; zero-unlimited (default admits many). All under
-race.Deferred to follow-up (parked on
sujatha/flow-control-setup-bounds, tracked on CRDB-65356): counting streams in setup against the cap, a control-payload-size bound, and a setup timeout. These bound half-open-stream memory that the admitted-stream cap alone does not; they're being landed separately to keep this PR to the concurrent-stream cap.