Skip to content

fix(p2p): collapse relay circuit dial fan-out and throttle denied dials - #693

Open
varex83agent wants to merge 1 commit into
mainfrom
fix/issue-564-relay-dial-fanout
Open

fix(p2p): collapse relay circuit dial fan-out and throttle denied dials#693
varex83agent wants to merge 1 commit into
mainfrom
fix/issue-564-relay-dial-fanout

Conversation

@varex83agent

Copy link
Copy Markdown
Collaborator

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 HOP CONNECT requests per peer pair and exhausted the relay's circuit rate limiter (794 ResourceLimitExceeded denials 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::Behaviour DialReq handling), 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: RelayDialError gains a ResourceLimitExceeded variant, classified by walking the source() chain of the boxed transport error (every intermediate Display drops its source, so the raw message was a useless "Failed to connect to destination."), and a denied campaign is parked for at least 30s via RelayDialState::throttle_denied instead of restarting the 1s ladder. Finally, upsert_peer_dial now swaps the address set in place rather than rebuilding the dial state, so a flapping relay no longer resets retry_count to zero on every Reserved transition and pins the campaign to the base delay forever.

Co-Authored-By: Bohdan Ohorodnii 35969035+varex83@users.noreply.github.com

Closes #564.

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
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.

bug(p2p): relay circuit dial fan-out floods relay; no denial-aware throttle

2 participants