Skip to content

Backport release/v6.7: Bound frozen RPC router batch allocations - #4049

Merged
masih merged 1 commit into
release/v6.7from
backport-4038-to-release/v6.7
Aug 28, 2026
Merged

masih merged 1 commit into
release/v6.7from
backport-4038-to-release/v6.7

Conversation

@seidroid

@seidroid seidroid Bot commented Aug 28, 2026

Copy link
Copy Markdown

Backport of #4038 to release/v6.7.

Limit JSON-RPC batches to 1,000 calls by default and reject oversized
batches during streaming decode with one bounded error response. Add a
configurable 30-second HTTP write timeout to release slow-client
handlers.

Fixes PLT-1085

(cherry picked from commit 7ab2f13)
@cursor

cursor Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Operational guardrails on the RPC router edge; behavior change only for batches above the limit or very slow writes, with sensible defaults.

Overview
Adds resource limits to frozen-rpc-router: JSON-RPC batches are capped at 1,000 calls by default (--batch-request-limit), and HTTP response writes use a 30s default (--write-timeout on the server).

Batch handling no longer unmarshals the whole array up front. decodeBatchCalls streams the batch with a JSON decoder, stops once the limit is reached, and returns a single JSON-RPC -32600 "batch too large" error for oversize batches—reducing unbounded allocations on huge batch bodies. Config and router construction wire the new settings through; README and tests cover defaults, validation, and rejection behavior.

Reviewed by Cursor Bugbot for commit 320d923. Bugbot is set up for automated code reviews on this repo. Configure here.

@seidroid seidroid Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The automated review did not complete; see the failing AI Review check for details.

@github-actions

github-actions Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedAug 28, 2026, 9:31 AM

@codecov

codecov Bot commented Aug 28, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 59.09091% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.30%. Comparing base (1e8d054) to head (320d923).

Files with missing lines Patch % Lines
cmd/frozen-rpc-router/router.go 55.55% 8 Missing and 8 partials ⚠️
cmd/frozen-rpc-router/main.go 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@               Coverage Diff                @@
##           release/v6.7    #4049      +/-   ##
================================================
- Coverage         61.30%   60.30%   -1.00%     
================================================
  Files              2163     2064      -99     
  Lines            188768   177206   -11562     
================================================
- Hits             115726   106868    -8858     
+ Misses            62315    60547    -1768     
+ Partials          10727     9791     -936     
Flag Coverage Δ
sei-chain-pr 62.12% <59.09%> (?)
sei-db 69.80% <ø> (ø)
sei-db-state-db ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
cmd/frozen-rpc-router/config.go 83.33% <100.00%> (+2.38%) ⬆️
cmd/frozen-rpc-router/main.go 0.00% <0.00%> (ø)
cmd/frozen-rpc-router/router.go 65.40% <55.55%> (+1.18%) ⬆️

... and 99 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@masih
masih requested a review from alexander-sei August 28, 2026 09:29
@masih
masih enabled auto-merge (squash) August 28, 2026 09:31

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 320d923. Configure here.

Addr: cfg.listenAddress,
Handler: router,
ReadHeaderTimeout: 10 * time.Second,
WriteTimeout: cfg.writeTimeout,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Write timeout breaks proxied WebSockets

Medium Severity

The new WriteTimeout is set on the single HTTP server that also reverse-proxies non-POST traffic, including WebSocket upgrades, through liveProxy. Go leaves that write deadline on hijacked connections, and httputil.ReverseProxy does not clear it, so upgraded sockets die when the timer fires. The 30s default cuts off long-lived subscriptions, and --write-timeout cannot be 0 to restore unbounded writes.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 320d923. Configure here.

@masih
masih disabled auto-merge August 28, 2026 09:40
@masih
masih merged commit 794ebbc into release/v6.7 Aug 28, 2026
78 of 83 checks passed
@masih
masih deleted the backport-4038-to-release/v6.7 branch August 28, 2026 09:40
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.

3 participants