-
Notifications
You must be signed in to change notification settings - Fork 746
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
litep2p/discovery: Fix memory leak in litep2p.public_addresses()
#5998
Conversation
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
…exnv/bound-dht-addreses
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Why do we have so many (>32) external addresses confirmed? Is there a linked issue in polkadot-sdk? |
This issue was reproduced in Rococo on litep2p validators, don't believe we have an gitissue for it. It looks like over time peers report via identify protocol connections on different ports. |
Co-authored-by: Dmitry Markin <[email protected]>
Co-authored-by: Dmitry Markin <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
This is the long standing issue for this happening on rococo: #3519 (comment), we never uncovered why so many external addresses accumulate on rococo. |
Created backport PR for
Please cherry-pick the changes locally and resolve any conflicts. git fetch origin backport-5998-to-stable2407
git worktree add --checkout .worktree/backport-5998-to-stable2407 backport-5998-to-stable2407
cd .worktree/backport-5998-to-stable2407
git reset --hard HEAD^
git cherry-pick -x 38aa4b755c5bb332436950363a9826a91de4b2ef
git push --force-with-lease |
…5998) This PR ensures that the `litep2p.public_addresses()` never grows indefinitely. - effectively fixes subtle memory leaks - fixes authority DHT records being dropped due to size limits being exceeded - provides a healthier subset of public addresses to the `/identify` protocol This PR adds a new `ExternalAddressExpired` event to the litep2p/discovery process. Substrate uses an LRU `address_confirmations` bounded to 32 address entries. The oldest entry is propagated via the `ExternalAddressExpired` event when a new address is added to the list (if capacity is exceeded). The expired address is then removed from the `litep2p.public_addresses()`, effectively limiting its size to 32 entries (the size of `address_confirmations` LRU). cc @paritytech/networking @alexggh --------- Signed-off-by: Alexandru Vasile <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Dmitry Markin <[email protected]> (cherry picked from commit 38aa4b7)
Successfully created backport PR for |
In litep2p backend we have the requirement that at least 2 different peers should report the same external address for it to become confirmed. So, in theory, it should be better with litep2p backend. |
…es()` (paritytech#5998)" This reverts commit 38aa4b7.
…5998) This PR ensures that the `litep2p.public_addresses()` never grows indefinitely. - effectively fixes subtle memory leaks - fixes authority DHT records being dropped due to size limits being exceeded - provides a healthier subset of public addresses to the `/identify` protocol This PR adds a new `ExternalAddressExpired` event to the litep2p/discovery process. Substrate uses an LRU `address_confirmations` bounded to 32 address entries. The oldest entry is propagated via the `ExternalAddressExpired` event when a new address is added to the list (if capacity is exceeded). The expired address is then removed from the `litep2p.public_addresses()`, effectively limiting its size to 32 entries (the size of `address_confirmations` LRU). cc @paritytech/networking @alexggh --------- Signed-off-by: Alexandru Vasile <[email protected]> Co-authored-by: Bastian Köcher <[email protected]> Co-authored-by: Dmitry Markin <[email protected]>
…stable2409` for a temporary apply to the downstream project.
…ry leak about `litep2p` on `stable2409` branch [PR #5998](paritytech/polkadot-sdk#5998) in the official Polkadot repository addresses this memory leak issue, but it has not been adopted because it constitutes a major change for the `stable2409` branch.
…ry leak about `litep2p` on `stable2409` branch [PR #5998](paritytech/polkadot-sdk#5998) in the official Polkadot repository addresses this memory leak issue, but it has not been adopted because it constitutes a major change for the `stable2409` branch.
This PR ensures that the
litep2p.public_addresses()
never grows indefinitely./identify
protocolThis PR adds a new
ExternalAddressExpired
event to the litep2p/discovery process.Substrate uses an LRU
address_confirmations
bounded to 32 address entries.The oldest entry is propagated via the
ExternalAddressExpired
event when a new address is added to the list (if capacity is exceeded).The expired address is then removed from the
litep2p.public_addresses()
, effectively limiting its size to 32 entries (the size ofaddress_confirmations
LRU).cc @paritytech/networking @alexggh