fix(swarm): bound Connection::poll iterations for cooperative scheduling - #6513
Open
akshitj11 wants to merge 2 commits into
Open
fix(swarm): bound Connection::poll iterations for cooperative scheduling#6513akshitj11 wants to merge 2 commits into
akshitj11 wants to merge 2 commits into
Conversation
Cap the fixed-point loop in Connection::poll with a 128-iteration budget and self-wake on exhaustion so Tokio workers are not monopolized during large muxer/handler progress bursts. Fixes libp2p#6438
dariusc93
reviewed
Jul 30, 2026
dariusc93
left a comment
Member
There was a problem hiding this comment.
Thanks for the PR. Left a couple of comments. Also, can you revert the description to the PR template? :)
Revert version to unpublished 0.48.0, replace budget macro with function.
Contributor
Author
|
@dariusc93 made the changes that was asked , you can review it :) |
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.
Description
Bound the fixed-point loop in
Connection::pollwith a 128-iteration cooperative budget.When exhausted, the connection returns
Poll::Pendingand self-wakes so the executor canschedule other tasks. Deliverable
Poll::Readypaths (handler events, address changes,keep-alive errors) are unchanged.
Fixes #6438
AI Assistance Disclosure
Used AI tooling for implementation and review; all changes self-reviewed and tested locally.
Change checklist