feat: add semaphore for blocking IO requests#20289
Merged
Conversation
Adds configurable limit for concurrent blocking IO requests (eth_call, eth_estimateGas, etc.) to prevent tokio blocking thread pool exhaustion. Configuration: - New config: max_blocking_io_requests (default: 256) - CLI arg: --rpc.max-blocking-io-requests - Semaphore limits concurrent blocking IO operations Trait additions to SpawnBlocking: - blocking_io_task_guard(): Returns blocking IO semaphore - acquire_owned_blocking_io(): Acquires single permit - acquire_many_owned_blocking_io(n): Acquires multiple permits - acquire_weighted_blocking_io(weight): Weighted permit acquisition that divides total permits by weight to limit concurrent requests The weighted variant ensures at least (weight - 1) permits remain available when total_permits divides evenly by weight, preventing complete semaphore exhaustion. Applied to: - eth_call: Uses single permit acquisition - eth_getProof: Uses weighted acquisition (weight=5)
e0f59a1 to
2b0567a
Compare
2b0567a to
0732132
Compare
shekhirin
reviewed
Dec 11, 2025
| Ok(async move { | ||
| let _permit = self | ||
| .acquire_owned() | ||
| .acquire_weighted_blocking_io(5) |
Member
There was a problem hiding this comment.
this feels like a magic number, can you elaborate why it's 5?
Collaborator
Author
There was a problem hiding this comment.
this basically enforces most 5 concurrent requests for this endpoint, while still leaving permits available
Member
There was a problem hiding this comment.
can we make this configurable? I expect some users have more than 5 concurrent eth_getProof and it's expected behaviour that they're ready for in terms of RAM
Collaborator
Author
There was a problem hiding this comment.
I can restore the previous behaviour by allocating the other semaphore
shekhirin
approved these changes
Dec 11, 2025
mattsse
added a commit
that referenced
this pull request
Dec 11, 2025
Vui-Chee
added a commit
to okx/reth
that referenced
this pull request
Dec 12, 2025
…number * upstream: (203 commits) feat(node-core): make rpc server args customizable (paradigmxyz#20312) feat: add `account_history_in_rocksdb` field to `StorageSettings` (paradigmxyz#20282) feat(engine): Add BAL stub methods to ExecutionPayload and BlockOrPayload (paradigmxyz#20311) docs: fix misleading links (paradigmxyz#20300) ci: add more sccache (paradigmxyz#20316) feat: bump alloy-evm (paradigmxyz#20314) feat: allow larger ws frames on client side (paradigmxyz#20307) docs: add architecture diagrams to ExEx documentation (paradigmxyz#20193) feat: add semaphore for blocking IO requests (paradigmxyz#20289) ci: scale down depot runners (paradigmxyz#20295) perf: fetch header directly (paradigmxyz#20294) docs(exex): fix DebugApi comment (paradigmxyz#20296) feat: add support for testing_ rpc namespace and testing_buildBlockV1 (paradigmxyz#20094) chore: update engine_getBlobs metric (paradigmxyz#20290) chore(optimism): move predeploy constant to op-alloy (paradigmxyz#20181) docs: fix stages order and add missing EraStage (paradigmxyz#20283) docs: improve map_add_ons method documentation (paradigmxyz#20248) feat: add `transaction_hash_numbers_in_rocksdb` field to `StorageSettings` (paradigmxyz#20209) docs: clarify network mode, tx gossip and NAT (paradigmxyz#20247) feat: add support for debug_getBadBlock (paradigmxyz#20177) ...
theochap
pushed a commit
to ethereum-optimism/optimism
that referenced
this pull request
Jan 22, 2026
theochap
pushed a commit
to ethereum-optimism/optimism
that referenced
this pull request
Feb 11, 2026
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.
Adds settings for explicitly limiting concurrent tokio blocking tasks intended for IO (for now enabled for ethcall)
Note: this isnt yet enforced for all spawned tasks and should be applied selectively, gonna use this to investigate #20059
closes #20090
see also #20059