Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Make identify-push autodial smarter #3038

Closed
wants to merge 7 commits into from
Closed

Conversation

shobit000
Copy link

Title

Enhance Identify Push to Avoid Connection Drops Due to Rate Limiter Violations

Description

This PR addresses Issue #2389, which describes a problem where multiple protocols being enabled simultaneously trigger multiple identify-push requests. This can overwhelm receiving peers and result in connection drops due to rate limiter violations.

Changes Made

  1. Added Rate Limiting and Batching Logic:
  • Introduced pLimit for concurrency control.

  • Batched identify-push requests to avoid overwhelming peers.

  1. Updated IdentifyPush Class:
  • Modified IdentifyPush class in packages/protocol-identify/src/identify-push.ts.

  • Implemented the rate limiting and batching logic in the push method.

  1. Enhanced Documentation:
  • Updated doc/SERVICES.md to reflect changes in the identify-push process.

  • Documented the new configuration options for IdentifyPush.

  1. Test Cases:
  • Updated packages/protocol-identify/test/push.spec.ts to include tests for the new rate limiting and batching logic.

  • Added a test case to ensure the number of concurrent identify-push requests is limited.

Files Changed

  • packages/protocol-identify/src/identify-push.ts

  • doc/SERVICES.md

  • packages/protocol-identify/test/push.spec.ts

Additional Information

Issue Link: Issue #2389
Repository: libp2p/js-libp2p

@shobit000 shobit000 requested a review from a team as a code owner March 6, 2025 12:02
@shobit000 shobit000 changed the title fix: Enhance Identify Push to Avoid Connection Drops Due to Rate Limiter Violations fix: Make identify-push autodial smarter Mar 6, 2025
Copy link
Member

@achingbrain achingbrain left a comment

Choose a reason for hiding this comment

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

This does not fix the issue in #2389. Multiple streams will still be opened if multiple protocols are registered/unregistered one after another.

Worse, the proposed fix would introduce a bug whereby busy nodes with lots of connections might succeed in sending push updates but nodes with only a few connections would not.

@achingbrain
Copy link
Member

Closing as all this does is introduce some whitespace changes and unused fields. It does not fix the issue.

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