Skip to content

bitswap/httpnet: Disconnect peers after client errors - #919

Merged
hsanjuan merged 6 commits into
mainfrom
bitswap-httpnet-disconnect-eventually
May 26, 2025
Merged

hsanjuan merged 6 commits into
mainfrom
bitswap-httpnet-disconnect-eventually

Conversation

@hsanjuan

@hsanjuan hsanjuan commented May 15, 2025

Copy link
Copy Markdown
Contributor

This adds a configuration option to disconnect from peers when they return too many errors of type client (404s, Gone, Forbidden, Moved, Redirect. etc). in a row.

Such peers with low hit rates on the blocks we ask for must not perpetually receive optimistic requests and are "disconnected" accordingly if they cross the threshold (100 by default). They will be recontacted if a record pointing to them appears.

The implementation logs the errors at the end of processing the responses for a wantlist (that is, once per wantlist), the tracking only locks the map on connect/disconnect events, allowing for low lock contention operations.

cc #918

This adds a configuration option to disconnect from peers when they return too many errors of
type client (404s, Gone, Forbidden, Moved, Redirect. etc). in a row.

Such peers with low hit rates on the blocks we ask for must not perpetually
receive optimistic requests and are "disconnected" accordingly if they cross
the threshold (100 by default). They will be recontacted if a record pointing
to them appears.

The implementation logs the errors at the end of processing the responses for
a wantlist (that is, once per wantlist), the tracking only locks the map on
connect/disconnect events, allowing for low lock contention operations.
@hsanjuan hsanjuan self-assigned this May 15, 2025
@hsanjuan
hsanjuan requested a review from a team as a code owner May 15, 2025 16:39
Comment thread bitswap/network/httpnet/error_tracker.go Outdated
@ipfs ipfs deleted a comment from agca52 May 20, 2025
gammazero
gammazero previously approved these changes May 20, 2025

@gammazero gammazero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See comment

Comment thread bitswap/network/httpnet/error_tracker.go Outdated
@hsanjuan
hsanjuan force-pushed the bitswap-httpnet-disconnect-eventually branch from 7289141 to 354981e Compare May 21, 2025 06:45
@hsanjuan
hsanjuan dismissed gammazero’s stale review May 21, 2025 06:45

updated code with a simple map

@hsanjuan
hsanjuan requested a review from gammazero May 21, 2025 06:45
@lidel lidel mentioned this pull request May 21, 2025
46 tasks
@hsanjuan
hsanjuan enabled auto-merge May 26, 2025 14:36
@hsanjuan
hsanjuan merged commit 771e2ed into main May 26, 2025
@gammazero
gammazero deleted the bitswap-httpnet-disconnect-eventually branch July 5, 2026 19:00
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.

2 participants