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

[switch] Connection manager and PeerBook report different numbers of connected peers #428

Closed
jacobheun opened this issue Apr 1, 2019 · 1 comment

Comments

@jacobheun
Copy link
Contributor

Logging out some stats on a running node, eventually the number of peers reported as connected via the Connection Manager and PeerBook starts to differ pretty dramatically. In this instance almost 160 peers.

Connection manager is tracking 409 peers
PeerBook has 578 connected peers

The Connection Manager connections are taken directly from the _peers map in the connection manager. The mapping is updated anytime a muxed connection is created or ends.

The PeerBook connections are determined by the PeerInfo instances in PeerBook that return an address from PeerInfo.isConnected(). These numbers should match. If not, the connection manager might not be pruning connections at the correct high water mark.

@daviddias daviddias changed the title Connection manager and PeerBook report different numbers of connected peers [switch] Connection manager and PeerBook report different numbers of connected peers Aug 22, 2019
@daviddias daviddias transferred this issue from libp2p/js-libp2p-switch Aug 22, 2019
@vasco-santos
Copy link
Member

This should not be a problem anymore as only the connectionManager stores connections now.

maschad pushed a commit to maschad/js-libp2p that referenced this issue Jun 21, 2023
[email protected] contained a breaking change so update it's use to get
the correct return types.
maschad pushed a commit to maschad/js-libp2p that referenced this issue Jun 21, 2023
## [7.0.1](libp2p/js-libp2p-kad-dht@v7.0.0...v7.0.1) (2023-03-10)

### Bug Fixes

* correct `KBucketTree` types ([libp2p#426](libp2p/js-libp2p-kad-dht#426)) ([ea8e6d0](libp2p/js-libp2p-kad-dht@ea8e6d0)), closes [/github.com/tristanls/k-bucket/blob/3aa5b4f1dacb835752995a25409ab319d2070b9e/index.js#L413](https://github.com/libp2p//github.com/tristanls/k-bucket/blob/3aa5b4f1dacb835752995a25409ab319d2070b9e/index.js/issues/L413)
* update p-queue types ([libp2p#428](libp2p/js-libp2p-kad-dht#428)) ([f5b85fc](libp2p/js-libp2p-kad-dht@f5b85fc))

### Trivial Changes

* replace err-code with CodeError ([libp2p#413](libp2p/js-libp2p-kad-dht#413)) ([e05d2a0](libp2p/js-libp2p-kad-dht@e05d2a0)), closes [js-libp2p#1269](libp2p#1269)
* Update .github/workflows/semantic-pull-request.yml [skip ci] ([a70ab3f](libp2p/js-libp2p-kad-dht@a70ab3f))
* Update .github/workflows/semantic-pull-request.yml [skip ci] ([1652c6c](libp2p/js-libp2p-kad-dht@1652c6c))
* Update .github/workflows/semantic-pull-request.yml [skip ci] ([ea13c2a](libp2p/js-libp2p-kad-dht@ea13c2a))
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

No branches or pull requests

2 participants