Skip to content

fix(rpc): hold one heavy slot per HTTP batch - #336

Merged
rootulp merged 2 commits into
mainfrom
codex/rpc-batch-heavy-guard
Nov 9, 2026
Merged

rootulp merged 2 commits into
mainfrom
codex/rpc-batch-heavy-guard

Conversation

@rootulp

@rootulp rootulp commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Celestia Core v0.42.8 holds one heavy-request semaphore slot for an entire HTTP JSON-RPC batch and keeps it until the buffered response is written. Rust previously released and reacquired the slot for every batch element, allowing concurrent batches to interleave large responses and letting the configured resource bound undercount them.

This change reuses one admission for all heavy elements in a batch and owns that admission in the Hyper response body so completion and cancellation both release it. URI and WebSocket calls keep their existing per-call admission behavior. The RPC qualification ledger is rebound to the changed audited source without changing its scope or readiness claims.

Validation:

  • cargo test -p rpc --lib (23 passed)
  • cargo clippy -p rpc --all-targets --all-features -- -D warnings
  • Complete local RPC evidence workflow, including 116 ledger tests and 150 nested semantic mutation tests
  • cargo fmt --all --check
  • git diff --check
  • Independent review against Celestia Core v0.42.8 found no implementation blockers

@rootulp
rootulp enabled auto-merge (squash) November 9, 2026 05:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T05:51:30.162565Z 26b3ec5 PR opened
🔒 Security Review ✅ Completed 2026-11-09T05:55:05.369819Z 26b3ec5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26b3ec5160

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 364 to 365
tokio::task::spawn_blocking(move || {
let _guard = guard;
if name == "abci_query" {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep the guard alive inside detached blocking work

If an HTTP client disconnects while this spawn_blocking task is running, Hyper drops the request future and therefore the guard held by jsonrpc_handler/call_route, but Tokio's already-started blocking task continues executing. Repeating heavy requests followed by immediate disconnects can consequently run an unbounded number of heavy operations despite max_concurrent_heavy_requests; the previous implementation moved the guard into this closure specifically so cancellation could not release the slot before the blocking work finished.

Useful? React with 👍 / 👎.

@rootulp
rootulp merged commit fa607d0 into main Nov 9, 2026
30 checks passed
@rootulp
rootulp deleted the codex/rpc-batch-heavy-guard branch November 9, 2026 06:09
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.

1 participant