fix(p2p): collapse relay circuit dial fan-out and throttle denied dials - #693
Open
varex83agent wants to merge 1 commit into
Open
fix(p2p): collapse relay circuit dial fan-out and throttle denied dials#693varex83agent wants to merge 1 commit into
varex83agent wants to merge 1 commit into
Conversation
Closes #564. Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
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.
Closes #564.
Circuit dials bundled one address per (reserved relay x relay transport addr) into a single
DialOpts, and libp2p dials every address concurrently — so one campaign fired N simultaneous HOPCONNECTrequests per peer pair and exhausted the relay's circuit rate limiter (794ResourceLimitExceededdenials in ~10 min on hoodi, all nodes at 0 peers). A relay's transport addrs are alternative routes to the relay, not to the target, and rust-libp2p's circuit client reuses the already-open relay connection (priv_client::BehaviourDialReqhandling), so the dial side is now collapsed to exactly one circuit address per reserved relay — mirroring what the reservation/listener side already does.Denials are now also acted on:
RelayDialErrorgains aResourceLimitExceededvariant, classified by walking thesource()chain of the boxed transport error (every intermediateDisplaydrops its source, so the raw message was a useless "Failed to connect to destination."), and a denied campaign is parked for at least 30s viaRelayDialState::throttle_deniedinstead of restarting the 1s ladder. Finally,upsert_peer_dialnow swaps the address set in place rather than rebuilding the dial state, so a flapping relay no longer resetsretry_countto zero on everyReservedtransition and pins the campaign to the base delay forever.Co-Authored-By: Bohdan Ohorodnii 35969035+varex83@users.noreply.github.com