Skip to content

harden(server): cap concurrent gRPC streams per connection - #99

Merged
0xHansLee merged 1 commit into
mainfrom
harden/grpc-stream-cap
Aug 7, 2026
Merged

harden(server): cap concurrent gRPC streams per connection#99
0xHansLee merged 1 commit into
mainfrom
harden/grpc-stream-cap

Conversation

@0xHansLee

Copy link
Copy Markdown
Collaborator

Problem

The kernel gRPC server sets no stream limit, so a single peer connection can park an unbounded number of concurrent long-lived handlers.

Fix

Set grpc.MaxConcurrentStreams(64). Legitimate load is a single co-located consensus client whose peak is ~10 parallel partial-decrypt streams plus a handful of lifecycle RPCs, far below the cap.

Tests

No new tests — declarative server option; existing suite passes.

issue: none

The kernel gRPC server had no stream limit, so a peer could park an
unbounded number of concurrent long-lived handlers. Legitimate load is a
single co-located consensus client, so cap streams per connection at 64.
@jinn-agent

jinn-agent Bot commented Aug 4, 2026

Copy link
Copy Markdown

No high-confidence issues found. The change is minimal and correct: grpc.MaxConcurrentStreams accepts uint32 and the untyped constant 64 converts without issue; the option is applied before grpc.NewServer is called; and the cap is well above the described legitimate peak of ~10 concurrent streams. The recovery interceptor not covering streaming RPCs is a pre-existing gap unrelated to this PR.


Review iteration 1 · Commit 4a8b918 · 2026-08-04T03:15:36Z

@wo-o wo-o left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found — see summary comment.

@0xHansLee
0xHansLee merged commit 9bae8da into main Aug 7, 2026
12 checks passed
@0xHansLee
0xHansLee deleted the harden/grpc-stream-cap branch August 7, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants