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

Make identify-push autodial smarter #2389

Open
wemeetagain opened this issue Feb 5, 2024 · 0 comments
Open

Make identify-push autodial smarter #2389

wemeetagain opened this issue Feb 5, 2024 · 0 comments
Labels
need/triage Needs initial labeling and prioritization

Comments

@wemeetagain
Copy link
Member

Description:

Imagine this scenario:

// MyApp has 10 protocols that get enabled once some event happens
class MyApp
  libp2p: Libp2p

  static async init(): Promise<MyApp> {
    return new MyApp(
      await createLibp2p({
        streamMuxer: mplex(),
        services: {
          identify: identify()
        }
    )
  }

  ...

  onSomeEvent(e) {
    await Promise.all([
      this.libp2p.handle('protocol1', ...),
      this.libp2p.handle('protocol2', ...),
      this.libp2p.handle('protocol3', ...),
      this.libp2p.handle('protocol4', ...),
      this.libp2p.handle('protocol5', ...)
      ...
    ])
  }
}

This innocuous app will likely drop all connections to peers that accept identify-push when the 'some event' happens.

  • Each call to libp2p.handle updates the local peer store, and triggers a separate identify-push.
  • These identify-push streams are locally opened and closed quickly.
  • Receiving peers receiving a bunch of spammy identify-push requests will send back stream resets.
  • These stream resets will appear to the local node coming from "unknown stream ids" and will blow the rate limiter limit, triggering a connection close.
@wemeetagain wemeetagain added the need/triage Needs initial labeling and prioritization label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/triage Needs initial labeling and prioritization
Projects
None yet
Development

No branches or pull requests

1 participant